flake.nix (2711B)
1 { 2 description = "NixOS + home-manager configuration"; 3 4 inputs = { 5 nixpkgs.url = "nixpkgs/nixpkgs-unstable"; 6 flake-utils.url = "github:numtide/flake-utils"; 7 8 home-manager = { 9 url = "github:nix-community/home-manager"; 10 inputs.nixpkgs.follows = "nixpkgs"; 11 }; 12 13 neovim = { 14 url = "github:neovim/neovim?dir=contrib"; 15 inputs.nixpkgs.follows = "nixpkgs"; 16 inputs.flake-utils.follows = "flake-utils"; 17 }; 18 19 vim-plugins-overlay = { 20 url = "github:vi-tality/vim-plugins-overlay"; 21 inputs.nixpkgs.follows = "nixpkgs"; 22 }; 23 24 idris2-pkgs = { 25 url = "github:claymager/idris2-pkgs"; 26 inputs.nixpkgs.follows = "nixpkgs"; 27 }; 28 29 emacs-overlay = { 30 url = "github:nix-community/emacs-overlay"; 31 inputs.nixpkgs.follows = "nixpkgs"; 32 }; 33 }; 34 35 outputs = 36 { self 37 , nixpkgs 38 , home-manager 39 , neovim 40 , vim-plugins-overlay 41 , idris2-pkgs 42 , emacs-overlay 43 , ... 44 }@inputs: 45 let 46 overlays = [ 47 neovim.overlay 48 vim-plugins-overlay.overlay 49 #idris2-pkgs.overlay 50 emacs-overlay.overlay 51 ]; 52 lib = nixpkgs.lib; 53 libExtra = import ./lib { inherit lib; }; 54 homeConfig = path: home-manager.lib.homeManagerConfiguration { 55 system = "x86_64-linux"; 56 homeDirectory = "/home/benjamin"; 57 username = "benjamin"; 58 configuration = { pkgs, ... }: { 59 nixpkgs.overlays = overlays; 60 imports = [ 61 path 62 ]; 63 }; 64 }; 65 in 66 { 67 nixosConfigurations.laptop = nixpkgs.lib.nixosSystem { 68 system = "x86_64-linux"; 69 modules = [ 70 ./nixos/laptop/configuration.nix 71 home-manager.nixosModules.home-manager 72 { 73 nixpkgs.overlays = overlays; 74 home-manager.useGlobalPkgs = true; 75 home-manager.useUserPackages = true; 76 home-manager.users.benjamin = import ./home/profiles/laptop.nix; 77 } 78 ]; 79 }; 80 81 packages.x86_64-linux = { 82 customize = 83 with import nixpkgs { system = "x86_64-linux"; }; 84 pkgs.callPackage ./customize.nix { }; 85 }; 86 87 defaultApp.x86_64-linux = { 88 type = "app"; 89 program = "${self.packages.x86_64-linux.customize}/bin/customize"; 90 }; 91 apps.x86_64-linux = lib.mapAttrs 92 (n: v: { 93 type = "app"; 94 program = "${self.home.${n}.activationPackage}/activate"; 95 }) 96 self.home; 97 #home = homeConfig ./home/home.nix; 98 home = libExtra.mapOnDir' ./home/profiles (name: a: lib.nameValuePair (lib.removeSuffix ".nix" name) (homeConfig "${toString ./home/profiles}/${name}")); 99 }; 100 }