NixOS and Home Manager config
1{
2 description = "Cyclamen: Nel's NixOS and Home Manager nix flake";
3
4 inputs = {
5 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6 home-manager = {
7 url = "github:nix-community/home-manager/master";
8 inputs.nixpkgs.follows = "nixpkgs";
9 };
10 wrappers = {
11 url = "github:lassulus/wrappers";
12 inputs.nixpkgs.follows = "nixpkgs";
13 };
14 };
15
16 outputs = {
17 self,
18 nixpkgs,
19 home-manager,
20 wrappers,
21 ...
22 } @ inputs: let
23 lib = nixpkgs.lib;
24 forAllSystems = function:
25 lib.genAttrs lib.systems.flakeExposed (
26 system: (function system nixpkgs.legacyPackages.${system})
27 );
28 in {
29 homeConfigurations."nel" = home-manager.lib.homeManagerConfiguration {
30 pkgs = nixpkgs.legacyPackages."x86_64-linux";
31 extraSpecialArgs = { inherit inputs; };
32 modules = [ ./homes/nel/default.nix ];
33 };
34
35 nixosConfigurations."nel-desktop" = nixpkgs.lib.nixosSystem {
36 specialArgs = { inherit inputs; };
37 modules = [ ./systems/nel-desktop/configuration.nix ];
38 };
39
40 devShells = forAllSystems (system: pkgs: {
41 rust = (pkgs.callPackage ./templates/rust/shell.nix { });
42 });
43
44 legacyPackages = forAllSystems (system: pkgs: (import ./pkgs.nix) pkgs wrappers);
45 packages = forAllSystems (system: pkgs: lib.filterAttrs
46 (_: pkg: let
47 isDerivation = lib.isDerivation pkg;
48 availableOnHost = lib.meta.availableOn pkgs.stdenv.hostPlatform pkg;
49 isBroken = pkg.meta.broken or false;
50 in isDerivation && !isBroken && availableOnHost)
51 self.legacyPackages.${system}
52 );
53
54 templates = {
55 rust = {
56 path = ./templates/rust;
57 description = "Basic rust project with nix";
58 };
59 };
60 };
61}