Flake: Refactor a bit on pipes.
This commit is contained in:
parent
44db743176
commit
3b6ae8212d
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
options = --option eval-cache false --fallback --print-build-logs --verbose
|
options = --option eval-cache false --fallback --print-build-logs --verbose --extra-experimental-features pipe-operators
|
||||||
flake = .
|
flake = .
|
||||||
hostname = $(shell hostname)
|
hostname = $(shell hostname)
|
||||||
|
|
||||||
|
|
50
flake.nix
50
flake.nix
|
@ -69,7 +69,9 @@
|
||||||
self,
|
self,
|
||||||
stylix,
|
stylix,
|
||||||
...
|
...
|
||||||
} @inputs: {
|
} @inputs: let
|
||||||
|
lib = nixpkgs.lib;
|
||||||
|
|
||||||
const = {
|
const = {
|
||||||
droidStateVersion = "24.05";
|
droidStateVersion = "24.05";
|
||||||
stateVersion = "24.11";
|
stateVersion = "24.11";
|
||||||
|
@ -84,9 +86,8 @@
|
||||||
builtins.attrNames (builtins.readDir path)
|
builtins.attrNames (builtins.readDir path)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
in {
|
||||||
devShells = let
|
devShells = let
|
||||||
# lib = nixpkgs.lib;
|
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
in {
|
in {
|
||||||
|
@ -102,14 +103,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosConfigurations = let
|
nixosConfigurations = let
|
||||||
mkHost = { system, hostname }: nixpkgs.lib.nixosSystem {
|
mkHost = { system, hostname }: lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = [
|
modules = [
|
||||||
# Make a device hostname match the one from this config.
|
# Make a device hostname match the one from this config.
|
||||||
{ networking.hostName = hostname; }
|
{ networking.hostName = hostname; }
|
||||||
|
|
||||||
# Specify current release version.
|
# Specify current release version.
|
||||||
{ system.stateVersion = self.const.stateVersion; }
|
{ system.stateVersion = const.stateVersion; }
|
||||||
|
|
||||||
# Add Home Manager module.
|
# Add Home Manager module.
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
|
@ -120,18 +121,16 @@
|
||||||
# HM config.
|
# HM config.
|
||||||
./home/NixOs.nix
|
./home/NixOs.nix
|
||||||
]
|
]
|
||||||
++ (self.ls ./host/${system}/${hostname})
|
++ (ls ./host/${system}/${hostname})
|
||||||
++ (self.ls ./option)
|
++ (ls ./option)
|
||||||
++ (self.ls ./config)
|
++ (ls ./config)
|
||||||
++ (self.ls ./overlay)
|
++ (ls ./overlay)
|
||||||
++ (self.ls ./system)
|
++ (ls ./system)
|
||||||
;
|
;
|
||||||
specialArgs = let
|
specialArgs = let
|
||||||
lib = nixpkgs.lib;
|
|
||||||
util = import ./lib/Util.nix { inherit lib; };
|
util = import ./lib/Util.nix { inherit lib; };
|
||||||
in {
|
in {
|
||||||
inherit (self) const __findFile;
|
inherit const __findFile inputs self poetry2nixJobber util;
|
||||||
inherit inputs self poetry2nixJobber util;
|
|
||||||
pkgsJobber = nixpkgsJobber.legacyPackages.${system}.pkgs;
|
pkgsJobber = nixpkgsJobber.legacyPackages.${system}.pkgs;
|
||||||
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
|
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
|
||||||
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
|
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
|
||||||
|
@ -140,15 +139,21 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
mkSystem = system: hostname: { "${hostname}" = mkHost { inherit system hostname; }; };
|
mkSystem = system: hostname: { "${hostname}" = mkHost { inherit system hostname; }; };
|
||||||
in nixpkgs.lib.foldl' (acc: h: acc // h) { } (
|
|
||||||
map (system: nixpkgs.lib.foldl' (acc: h: acc // h) { } (
|
systems = builtins.attrNames (builtins.readDir ./host) |> map (system: {
|
||||||
map (host: mkSystem system host) (builtins.attrNames (builtins.readDir ./host/${system}))
|
inherit system;
|
||||||
)) (builtins.attrNames (builtins.readDir ./host))
|
hosts = builtins.attrNames (builtins.readDir ./host/${system});
|
||||||
);
|
});
|
||||||
|
|
||||||
|
hosts = map (system:
|
||||||
|
map (host: { inherit host; inherit (system) system; }) system.hosts
|
||||||
|
) systems |> lib.foldl' (acc: h: acc ++ h) [];
|
||||||
|
|
||||||
|
configurations = map (cfg: mkSystem cfg.system cfg.host) hosts;
|
||||||
|
in
|
||||||
|
lib.foldl' (result: cfg: result // cfg) {} configurations;
|
||||||
|
|
||||||
nixOnDroidConfigurations.default = let
|
nixOnDroidConfigurations.default = let
|
||||||
# config = self.nixOnDroidConfigurations.default.config;
|
|
||||||
lib = nixpkgs.lib;
|
|
||||||
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
|
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
|
||||||
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
|
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
|
||||||
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
|
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
|
||||||
|
@ -160,11 +165,10 @@
|
||||||
{ home-manager.config.stylix.autoEnable = lib.mkForce false; }
|
{ home-manager.config.stylix.autoEnable = lib.mkForce false; }
|
||||||
./home/Android.nix
|
./home/Android.nix
|
||||||
]
|
]
|
||||||
++ (self.ls ./option)
|
++ (ls ./option)
|
||||||
;
|
;
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
inherit inputs self pkgsMaster pkgsUnstable;
|
inherit inputs self pkgsMaster pkgsUnstable const __findFile;
|
||||||
inherit (self) const __findFile;
|
|
||||||
secret = import ./secret { };
|
secret = import ./secret { };
|
||||||
util = import ./lib/Util.nix { inherit lib; };
|
util = import ./lib/Util.nix { inherit lib; };
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
experimental-features = [
|
experimental-features = [
|
||||||
"flakes"
|
"flakes"
|
||||||
"nix-command"
|
"nix-command"
|
||||||
|
"pipe-operators"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue