1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-30 19:47:47 +00:00

Clean up flake

This commit is contained in:
RGBCube 2023-11-23 13:46:44 +03:00
parent 345217b900
commit 73ee4b2873
No known key found for this signature in database
2 changed files with 130 additions and 119 deletions

70
flake.lock generated
View file

@ -8,11 +8,11 @@
"rust-analyzer-src": "rust-analyzer-src" "rust-analyzer-src": "rust-analyzer-src"
}, },
"locked": { "locked": {
"lastModified": 1700374854, "lastModified": 1700720546,
"narHash": "sha256-mJOk9Rg5dbh9LorTKaiXlxCpfLZju/ngSvDABPzv870=", "narHash": "sha256-p31fe4lp2KBCyUf58mgai1xYjMLl5S0PQiSvv9+1j/Y=",
"owner": "nix-community", "owner": "nix-community",
"repo": "fenix", "repo": "fenix",
"rev": "95b4121cdcf9d6e91666305a1a9c57e483947e15", "rev": "5ade7808d45671b545f3516adf61bc9a604a6246",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -21,18 +21,18 @@
"type": "github" "type": "github"
} }
}, },
"home-manager": { "homeManager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1700386809, "lastModified": 1700695018,
"narHash": "sha256-2IPxWo0Yplv+70EueZVLTwRAijax0tirYp5Jh0QV1A4=", "narHash": "sha256-MAiPLgBF4GLzSOlhnPCDWkWW5CDx4i7ApIYaR+TwTVg=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "9a4725afa67db35cdf7be89f30527d745194cafa", "rev": "134deb46abd5d0889d913b8509413f6f38b0811e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -50,11 +50,11 @@
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1700397206, "lastModified": 1700696626,
"narHash": "sha256-ityVJcy3I/E8soXctwWveg58+cXOSQXhDIcU6YR2gjI=", "narHash": "sha256-Rr6s2HE9v0AlI630WAE+12usUJpwd3fAP6Gvk7rF5v4=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "Hyprland", "repo": "Hyprland",
"rev": "646f4bc63861e03b01fed3833bb65d1d014e1bf3", "rev": "e55c5a916ab942e641339471bc80b6d2efbc2044",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -106,11 +106,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1700204040, "lastModified": 1700390070,
"narHash": "sha256-xSVcS5HBYnD3LTer7Y2K8ZQCDCXMa3QUD1MzRjHzuhI=", "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad", "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -123,19 +123,20 @@
"root": { "root": {
"inputs": { "inputs": {
"fenix": "fenix", "fenix": "fenix",
"home-manager": "home-manager", "homeManager": "homeManager",
"hyprland": "hyprland", "hyprland": "hyprland",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2",
"utils": "utils"
} }
}, },
"rust-analyzer-src": { "rust-analyzer-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1700247620, "lastModified": 1700642897,
"narHash": "sha256-+Xg0qZLbC9dZx0Z6JbaVHR/BklAr2I83dzKLB8r41c8=", "narHash": "sha256-LoyZRcl0bBuSnV9SVqrf+vUxN1u9FeYk4vgQS/kyCOI=",
"owner": "rust-lang", "owner": "rust-lang",
"repo": "rust-analyzer", "repo": "rust-analyzer",
"rev": "255eed40c45fcf108ba844b4ad126bdc4e7a18df", "rev": "7ceefc7ee981f7dd9de4cfdd070696e48b4ab43e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -160,6 +161,39 @@
"type": "github" "type": "github"
} }
}, },
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"wlroots": { "wlroots": {
"flake": false, "flake": false,
"locked": { "locked": {

179
flake.nix
View file

@ -2,11 +2,6 @@
description = "My NixOS configurations."; description = "My NixOS configurations.";
nixConfig = { nixConfig = {
extra-experimental-features = ''
nix-command
flakes
'';
extra-substituters = '' extra-substituters = ''
https://nix-community.cachix.org/ https://nix-community.cachix.org/
https://hyprland.cachix.org/ https://hyprland.cachix.org/
@ -28,6 +23,10 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
utils = {
url = "github:numtide/flake-utils";
};
fenix = { fenix = {
url = "github:nix-community/fenix"; url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -38,112 +37,90 @@
}; };
}; };
outputs = { nixpkgs, homeManager, fenix, ... } @ inputs: let outputs = { nixpkgs, homeManager, utils, fenix, hyprland, ... }: utils.lib.eachDefaultSystem (system: let
machines = [ lib = nixpkgs.lib;
./machines/enka
];
architectures = [ ulib = rec {
"x86_64-linux" recursiveUpdate3 = x: y: z: lib.recursiveUpdate x (lib.recursiveUpdate y z);
];
lib = nixpkgs.lib // { imports = paths: {
recursiveUpdate3 = x: y: z: lib.recursiveUpdate x (lib.recursiveUpdate y z); imports = paths;
};
theme = import ./themes/gruvbox.nix;
# GENERAL
imports = importPaths: {
imports = importPaths;
};
enabled = attributes: attributes // {
enable = true;
};
normalUser = attributes: attributes // {
isNormalUser = true;
};
# SYSTEM
systemConfiguration = attributes: attributes;
systemPackages = packages: systemConfiguration {
environment.systemPackages = packages;
};
systemFonts = fonts: systemConfiguration {
fonts.packages = fonts;
};
# HOME
homeConfiguration = userName: attributes: systemConfiguration {
home-manager.users = builtins.foldl' lib.recursiveUpdate {} (builtins.map (userName: {
${userName} = attributes;
}) (if builtins.isList userName then userName else [ userName ]));
};
homePackages = userName: packages: homeConfiguration userName {
home.packages = packages;
};
importConfiguration = configurationDirectory: hostPlatform: let
hostName = builtins.baseNameOf configurationDirectory;
pkgs = import nixpkgs {
system = hostPlatform;
config.allowUnfree = true;
overlays = [
fenix.overlays.default
];
}; };
hyprland = inputs.hyprland.packages.${hostPlatform}.hyprland; enabled = attributes: attributes // {
enable = true;
arguments = {
inherit lib pkgs hyprland theme systemConfiguration systemPackages homeConfiguration systemFonts homePackages imports enabled normalUser;
}; };
defaultConfiguration = { normalUser = attributes: attributes // {
nix.gc = { isNormalUser = true;
automatic = true;
dates = "daily";
options = "--delete-older-than 3d";
persistent = true;
};
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
nix.registry.nixpkgs.flake = nixpkgs;
nix.optimise.automatic = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
environment.defaultPackages = [];
boot.tmp.cleanOnBoot = true;
networking.hostName = hostName;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}; };
systemConfiguration = attributes: attributes;
systemPackages = packages: systemConfiguration {
environment.systemPackages = packages;
};
systemFonts = fonts: systemConfiguration {
fonts.packages = fonts;
};
homeConfiguration = user: attributes: systemConfiguration {
home-manager.users = builtins.foldl' lib.recursiveUpdate {} (builtins.map (user: {
${user} = attributes;
}) (if builtins.isList user then user else [ user ]));
};
homePackages = user: packages: homeConfiguration user {
home.packages = packages;
};
};
defaultConfiguration = host: ulib.systemConfiguration {
nix.gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 3d";
persistent = true;
};
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
nix.registry.nixpkgs.flake = nixpkgs;
nix.optimise.automatic = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [
fenix.overlays.default
hyprland.overlays.default
];
environment.defaultPackages = [];
boot.tmp.cleanOnBoot = true;
networking.hostName = host;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
};
specialArgs = {
inherit ulib;
};
in {
nixosConfigurations.enka = lib.nixosSystem {
inherit specialArgs;
modules = [ modules = [
homeManager.nixosModules.default homeManager.nixosModules.default
defaultConfiguration (defaultConfiguration "enka")
configurationDirectory ./machines/enka
]; ];
in {
nixosConfigurations.${hostName} = lib.nixosSystem {
specialArgs = arguments;
modules = modules;
};
}; };
in builtins.foldl' lib.recursiveUpdate {} (builtins.concatMap (architecture: builtins.map (configuration: importConfiguration configuration architecture) machines) architectures); });
} }