Skip to content

Instantly share code, notes, and snippets.

@mikelane
Created March 29, 2024 00:00
Show Gist options
  • Save mikelane/d8477b09a8200d527059dcd0a736ec6d to your computer and use it in GitHub Desktop.
Save mikelane/d8477b09a8200d527059dcd0a736ec6d to your computer and use it in GitHub Desktop.
$HOME/nixos/flake.nix
{
description = "Mike's NixOS Flake";
nixConfig = {
experimental-features = [ "nix-command" "flakes" ];
extra-substituters = [
# Nix community's cache server
"https://nix-community.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
agenix.url = "github:ryantm/agenix";
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
helix.url = "github:helix-editor/helix/23.05";
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
alacritty-theme.url = "github:alexghr/alacritty-theme.nix";
};
outputs = inputs@{ self, nixpkgs, nixpkgs-stable, home-manager, flake-utils, alacritty-theme, agenix, ... }:
let
pkgs = nixpkgs.legacyPackages."x86_64-linux";
pkgs-stable = nixpkgs-stable.legacyPackages."x86_64-linux";
in
{
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./hosts/desktop/configuration.nix
agenix.nixosModules.default
({ pkgs, ... }: {
nixpkgs.overlays = [ inputs.alacritty-theme.overlays.default ];
})
home-manager.nixosModules.home-manager
({ pkgs, ... }: {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.mikelane = import ./home/mikelane;
home-manager.extraSpecialArgs = { inherit inputs pkgs-stable; };
})
({ config, pkgs, ... }: {
environment.systemPackages = [
pkgs.home-manager
agenix.packages.x86_64-linux.default
(pkgs.callPackage ./scripts/update.nix { })
(pkgs.callPackage ./scripts/flake-update.nix { })
(pkgs.callPackage ./scripts/cecho.nix { })
(pkgs.callPackage ./scripts/kubectl-change-context.nix { })
(pkgs.callPackage ./scripts/generate-commit-message.nix { })
(pkgs.callPackage ./scripts/generate-pull-request.nix { })
(pkgs.callPackage ./scripts/tunnel-to-rds.nix { })
(pkgs.callPackage ./scripts/sso.nix { })
(pkgs.callPackage ./scripts/getktxs.nix { })
(pkgs.callPackage ./scripts/sshpod.nix { })
];
})
];
};
homeConfigurations = {
mikelane = home-manager.lib.homeManagerConfiguration {
imports = [
./home/mikelane/default.nix
];
system = "x86_64-linux";
homeDirectory = "/home/mikelane";
username = "mikelane";
configuration = { pkgs, ... }: { };
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment