{ description = "NixOS configurations for my machines"; inputs = { nixpkgs.url = github:nixos/nixpkgs/nixos-22.05; nixos-hardware = { url = github:nixos/nixos-hardware/master; inputs.nixpkgs.follows = "nixpkgs"; }; home-manager = { url = "https://github.com/nix-community/home-manager/archive/release-22.05.tar.gz"; inputs.nixpkgs.follows = "nixpkgs"; }; sops-nix = { url = github:Mic92/sops-nix; # sops-nix uses both -22.05 and -unstable in their flake. # As far as I can tell, 22.05 is only used for testing, whereas unstable # is used for the tooling. So here, I let both of these follow our # nixpkgs input. Note that after NixOS releases, this might break since # they may do away with 22.05 at that point. # https://github.com/Mic92/sops-nix/blob/master/flake.nix inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs-22_05.follows = "nixpkgs"; }; }; outputs = inputs @ { self, nixpkgs, nixos-hardware, home-manager, sops-nix, ... }: let system = "x86_64-linux"; homeManagerConfFor = config: { ... }: { imports = [ config ]; }; jacobHome = homeManagerConfFor ./home/jacob.nix; jacobHomeMod = { home-manager = { useGlobalPkgs = true; useUserPackages = true; users.jacob = jacobHome; }; }; mkNixosSystem = extraModules: nixpkgs.lib.nixosSystem { inherit system; # see https://dataswamp.org/~solene/2022-07-20-nixos-flakes-command-sync-with-system.html specialArgs = { inherit inputs; }; modules = [ home-manager.nixosModules.home-manager jacobHomeMod sops-nix.nixosModules.sops ] ++ extraModules; }; in { homeManagerConfigurations = { jacob = jacobHome; }; nixosConfigurations = { # Thinkpad T470 laptop buck = mkNixosSystem [ nixos-hardware.nixosModules.lenovo-thinkpad-t470s ./machines/buck/configuration.nix ]; # ThinkCentre M700 mini-pc (server) cj = mkNixosSystem [ nixos-hardware.nixosModules.common-pc-hdd nixos-hardware.nixosModules.common-cpu-intel-cpu-only ./machines/cj/configuration.nix ]; }; }; }