chore(inputs): Modularize modules, inputs and update instructions
This commit is contained in:
parent
decd0f5110
commit
512d6d2dd4
5 changed files with 168 additions and 121 deletions
|
|
@ -23,6 +23,40 @@ dashNix = {
|
|||
|
||||
You can then configure your systems in your flake outputs with a provided library command:
|
||||
|
||||
Please note that overriding inputs will invalidate the cache configuration, this means you will have to add this manually:
|
||||
|
||||
```nix
|
||||
builders-use-substitutes = true;
|
||||
|
||||
extra-substituters = [
|
||||
"https://hyprland.cachix.org"
|
||||
"https://anyrun.cachix.org"
|
||||
"https://cache.garnix.io"
|
||||
"https://oxipaste.cachix.org"
|
||||
"https://oxinoti.cachix.org"
|
||||
"https://oxishut.cachix.org"
|
||||
"https://oxidash.cachix.org"
|
||||
"https://oxicalc.cachix.org"
|
||||
"https://hyprdock.cachix.org"
|
||||
"https://reset.cachix.org"
|
||||
"https://dashvim.cachix.org"
|
||||
];
|
||||
|
||||
extra-trusted-public-keys = [
|
||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
|
||||
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
|
||||
"oxipaste.cachix.org-1:n/oA3N3Z+LJP7eIWOwuoLd9QnPyZXqFjLgkahjsdDGc="
|
||||
"oxinoti.cachix.org-1:dvSoJl2Pjo5HMaNngdBbSaixK9BSf2N8gzjP2MdGvfc="
|
||||
"oxishut.cachix.org-1:axyAGF3XMh1IyMAW4UMbQCdMNovDH0KH6hqLLRJH8jU="
|
||||
"oxidash.cachix.org-1:5K2FNHp7AS8VF7LmQkJAUG/dm6UHCz4ngshBVbjFX30="
|
||||
"oxicalc.cachix.org-1:qF3krFc20tgSmtR/kt6Ku/T5QiG824z79qU5eRCSBTQ="
|
||||
"hyprdock.cachix.org-1:HaROK3fBvFWIMHZau3Vq1TLwUoJE8yRbGLk0lEGzv3Y="
|
||||
"reset.cachix.org-1:LfpnUUdG7QM/eOkN7NtA+3+4Ar/UBeYB+3WH+GjP9Xo="
|
||||
"dashvim.cachix.org-1:uLRdxp1WOWHnsZZtu3SwUWZRsvC7SXo0Gyk3tIefuL0="
|
||||
];
|
||||
```
|
||||
|
||||
```nix
|
||||
nixosConfigurations = inputs.dashNix.dashNixLib.buildSystems { root = ./.; };
|
||||
```
|
||||
|
|
@ -96,29 +130,29 @@ Here is a minimal required configuration.nix (the TODOs mention a required chang
|
|||
# sddm = { };
|
||||
# gdm = { };
|
||||
drives = {
|
||||
# default assumes ROOT, BOOT, HOME and SWAP labaled drives exist
|
||||
# for an example without HOME see below
|
||||
# defaultDrives.enable = false;
|
||||
# extraDrives = [
|
||||
# {
|
||||
# name = "boot";
|
||||
# drive = {
|
||||
# device = "/dev/disk/by-label/BOOT";
|
||||
# fsType = "vfat";
|
||||
# options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ];
|
||||
# };
|
||||
# }
|
||||
# {
|
||||
# name = "";
|
||||
# drive = {
|
||||
# device = "/dev/disk/by-label/ROOT";
|
||||
# fsType = "ext4";
|
||||
# options = [ "noatime" "nodiratime" "discard" ];
|
||||
# };
|
||||
# }
|
||||
# ];
|
||||
# You can also use disko to format your disks on installation.
|
||||
# Please refer to the Documentation about the drives module for an example.
|
||||
# default assumes ROOT, BOOT, HOME and SWAP labaled drives exist
|
||||
# for an example without HOME see below
|
||||
# defaultDrives.enable = false;
|
||||
# extraDrives = [
|
||||
# {
|
||||
# name = "boot";
|
||||
# drive = {
|
||||
# device = "/dev/disk/by-label/BOOT";
|
||||
# fsType = "vfat";
|
||||
# options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ];
|
||||
# };
|
||||
# }
|
||||
# {
|
||||
# name = "";
|
||||
# drive = {
|
||||
# device = "/dev/disk/by-label/ROOT";
|
||||
# fsType = "ext4";
|
||||
# options = [ "noatime" "nodiratime" "discard" ];
|
||||
# };
|
||||
# }
|
||||
# ];
|
||||
# You can also use disko to format your disks on installation.
|
||||
# Please refer to the Documentation about the drives module for an example.
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -128,48 +162,14 @@ Here is a minimal required configuration.nix (the TODOs mention a required chang
|
|||
|
||||
After logging in the first time, your password will be set to "firstlogin", please change this to whatever you like.
|
||||
|
||||
## Nixos and Home-manager Modules
|
||||
|
||||
You can add additional modules or remove all of them by overriding parameters to the buildSystems command:
|
||||
|
||||
```nix
|
||||
nixosConfigurations =
|
||||
let
|
||||
additionalMods = {
|
||||
nixos = [
|
||||
# your modules
|
||||
]; home = [
|
||||
# your modules
|
||||
];
|
||||
}
|
||||
# passing this parameter will override the existing modules
|
||||
mods = {
|
||||
nixos = [];
|
||||
home = [];
|
||||
}
|
||||
in
|
||||
inputs.dashNix.dashNixLib.buildSystems { root = ./.; inherit mods additionalMods; };
|
||||
```
|
||||
|
||||
## Additional Inputs
|
||||
|
||||
Just like modules, you can add additional inputs to your configuration.
|
||||
|
||||
```nix
|
||||
nixosConfigurations =
|
||||
let
|
||||
additionalInputs = {
|
||||
something.url = "yoururl"
|
||||
}
|
||||
in
|
||||
inputs.dashNix.dashNixLib.buildSystems { root = ./.; inherit additionalInputs; };
|
||||
```
|
||||
|
||||
## Configuring pkgs
|
||||
|
||||
While DashNix offers a default pkgs config, you may want to permit an unsecure packages or add an overlay to them.
|
||||
While DashNix offers a default pkgs config, you may want to permit an unsecure packages,
|
||||
add additional modules/inputs, or add an overlay to them.
|
||||
You can configure both stable and unstable pkgs the following way:
|
||||
|
||||
Please note that modules and inputs are merged together to ensure functionality.
|
||||
|
||||
```nix
|
||||
currentSystem = "x86_64-linux";
|
||||
permittedPackages = [
|
||||
|
|
@ -181,10 +181,21 @@ config = {
|
|||
allowUnfree = true;
|
||||
permittedInsecurePackages = permittedPackages;
|
||||
};
|
||||
inputs = {
|
||||
# Some inputs
|
||||
}
|
||||
mods = {
|
||||
home = [
|
||||
# Some home manager module
|
||||
];
|
||||
nixos = [
|
||||
# Some nixos module
|
||||
];
|
||||
}
|
||||
};
|
||||
unstableBundle = {
|
||||
pkgs = inputs.unstable;
|
||||
inherit config;
|
||||
inherit config mods;
|
||||
};
|
||||
inputs.dashNix.dashNixLib.buildSystems {
|
||||
root = ./.;
|
||||
|
|
@ -201,24 +212,26 @@ this way however ensures you can also configure the inputs.
|
|||
Sometimes you want to differentiate between systems that are stable and unstable, e.g. for servers and desktops/laptops.
|
||||
This can be done with the overridePkgs flag for the lib function:
|
||||
|
||||
(overridePkgs simply inverts the default bundle that is used for the nix standard library as well as NixOS itself)
|
||||
|
||||
```nix
|
||||
nixosConfigurations =
|
||||
inputs.dashNix.dashNixLib.buildSystems {
|
||||
root = ./stable;
|
||||
inherit additionalInputs;
|
||||
overridePkgs = true;
|
||||
}
|
||||
// inputs.dashNix.dashNixLib.buildSystems {
|
||||
root = ./unstable;
|
||||
inherit additionalInputs;
|
||||
};
|
||||
nixosConfigurations =
|
||||
inputs.dashNix.dashNixLib.buildSystems {
|
||||
root = ./stable;
|
||||
inherit stableBundle;
|
||||
overridePkgs = true;
|
||||
}
|
||||
// inputs.dashNix.dashNixLib.buildSystems {
|
||||
inherit unstableBundle;
|
||||
root = ./unstable;
|
||||
};
|
||||
```
|
||||
|
||||
You can now place your systems in the respective directories.
|
||||
Keep in mind that the hosts directory will still need to exist in each variant.
|
||||
E.g. stable/hosts/yourserver and unstable/hosts/yourdesktop
|
||||
|
||||
# Installation
|
||||
# Installation via ISO
|
||||
|
||||
You can find a custom ISO in the releases: [Link](https://github.com/Xetibo/DashNix/releases).
|
||||
With this, you will receive the example config in /iso/example alongside the gnome desktop environment,
|
||||
|
|
@ -252,6 +265,17 @@ sudo disko-install --flake <flakelocation>#<hostname> --disk <disk-name> <disk-d
|
|||
#disko-install -- --flake ~/config#globi --disk main /dev/nvme0n1 --option experimental-features "nix-command flakes pipe-operators"
|
||||
```
|
||||
|
||||
# Installation via flake
|
||||
|
||||
If you already have nix installed, you can instead just copy the default config onto your system and install DashNix with it.
|
||||
To create the example config for a base to start with, you can just run this flake with the mkFlake command:
|
||||
|
||||
```sh
|
||||
nix run github:Xetibo/DashNix#mkFlake
|
||||
```
|
||||
|
||||
This command will put the default configuration into $HOME/gits/nixos
|
||||
|
||||
# Modules
|
||||
|
||||
This configuration features several modules that can be used as preconfigured "recipies".
|
||||
|
|
@ -302,3 +326,4 @@ For package lists, please check the individual modules, as the lists can be long
|
|||
- [chermnyx](https://github.com/chermnyx) for providing a base for zen configuration
|
||||
- [voronind-com](https://github.com/voronind-com) for providing the darkreader configuration
|
||||
- [Nix-Artwork](https://github.com/NixOS/nixos-artwork/tree/master/logo) for the Nix/NixOS logo (Tim Cuthbertson (@timbertson))
|
||||
- [xddxdd](https://github.com/xddxdd) for the CachyOS-Kernel flake
|
||||
|
|
|
|||
15
flake.nix
15
flake.nix
|
|
@ -94,5 +94,20 @@
|
|||
modules = ./modules;
|
||||
iso = dashNixLib.buildIso.config.system.build.isoImage;
|
||||
nixosConfigurations = dashNixLib.buildSystems {root = ./example/.;};
|
||||
|
||||
mkFlake = stablePkgs.writeShellApplication {
|
||||
name = "Create example config";
|
||||
text =
|
||||
/*
|
||||
bash
|
||||
*/
|
||||
''
|
||||
mkdir -p ~/gits/nixos
|
||||
mkdir -p ~/gits/backup_nixos
|
||||
|
||||
mv ~/gits/nixos/* ~/gits/backup_nixos/
|
||||
cp -r ${./example}/* ~/gits/nixos/
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
{
|
||||
mkDashDefault,
|
||||
additionalHomeConfig,
|
||||
additionalHomeMods,
|
||||
additionalInputs,
|
||||
dashNixAdditionalProps,
|
||||
config,
|
||||
homeMods,
|
||||
|
|
@ -42,7 +39,6 @@
|
|||
inherit
|
||||
inputs
|
||||
root
|
||||
additionalInputs
|
||||
alternativePkgs
|
||||
system
|
||||
stable
|
||||
|
|
@ -62,9 +58,7 @@
|
|||
../lib/foxwrappers.nix
|
||||
]
|
||||
++ homeMods
|
||||
++ additionalHomeMods
|
||||
++ lib.optional (builtins.pathExists mod) mod
|
||||
++ lib.optional (builtins.pathExists additionalHomeConfig) additionalHomeConfig;
|
||||
++ lib.optional (builtins.pathExists mod) mod;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,50 +60,55 @@ in {
|
|||
# in
|
||||
buildSystems = {
|
||||
root,
|
||||
additionalMods ? {
|
||||
nixos = [];
|
||||
home = [];
|
||||
},
|
||||
mods ? {
|
||||
nixos = [
|
||||
inputs.lanzaboote.nixosModules.lanzaboote
|
||||
inputs.nixos-wsl.nixosModules.default
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.stylix.nixosModules.stylix
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.superfreq.nixosModules.default
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
../base
|
||||
../home
|
||||
../modules
|
||||
];
|
||||
home = [
|
||||
inputs.anyrun.homeManagerModules.default
|
||||
inputs.ironbar.homeManagerModules.default
|
||||
inputs.oxicalc.homeManagerModules.default
|
||||
inputs.oxishut.homeManagerModules.default
|
||||
inputs.oxinoti.homeManagerModules.default
|
||||
inputs.oxidash.homeManagerModules.default
|
||||
inputs.oxipaste.homeManagerModules.default
|
||||
inputs.oxirun.homeManagerModules.default
|
||||
inputs.hyprdock.homeManagerModules.default
|
||||
inputs.hyprland.homeManagerModules.default
|
||||
inputs.reset.homeManagerModules.default
|
||||
inputs.sops-nix.homeManagerModules.sops
|
||||
inputs.dashvim.homeManagerModules.dashvim
|
||||
../modules
|
||||
];
|
||||
},
|
||||
additionalInputs ? {},
|
||||
unstableBundle ? {},
|
||||
stableBundle ? {},
|
||||
overridePkgs ? false,
|
||||
...
|
||||
}: let
|
||||
defaultNixosMods = inputs: [
|
||||
inputs.lanzaboote.nixosModules.lanzaboote
|
||||
inputs.nixos-wsl.nixosModules.default
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.stylix.nixosModules.stylix
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.superfreq.nixosModules.default
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
../base
|
||||
../home
|
||||
../modules
|
||||
];
|
||||
|
||||
defaultHomeMods = inputs: [
|
||||
inputs.anyrun.homeManagerModules.default
|
||||
inputs.ironbar.homeManagerModules.default
|
||||
inputs.oxicalc.homeManagerModules.default
|
||||
inputs.oxishut.homeManagerModules.default
|
||||
inputs.oxinoti.homeManagerModules.default
|
||||
inputs.oxidash.homeManagerModules.default
|
||||
inputs.oxipaste.homeManagerModules.default
|
||||
inputs.oxirun.homeManagerModules.default
|
||||
inputs.hyprdock.homeManagerModules.default
|
||||
inputs.hyprland.homeManagerModules.default
|
||||
inputs.reset.homeManagerModules.default
|
||||
inputs.sops-nix.homeManagerModules.sops
|
||||
inputs.dashvim.homeManagerModules.dashvim
|
||||
../modules
|
||||
];
|
||||
|
||||
unstableInput = unstableBundle.pkgs or inputs.unstable;
|
||||
stableInput = stableBundle.pkgs or inputs.stable;
|
||||
unstableConfig = unstableBundle.config or defaultConfig;
|
||||
stableConfig = stableBundle.config or defaultConfig;
|
||||
unstableInputs = (unstableBundle.inputs or {}) // inputs;
|
||||
stableInputs = (stableBundle.inputs or {}) // inputs;
|
||||
unstableMods = {
|
||||
home = (defaultHomeMods unstableInputs) ++ (unstableBundle.mods.home or []);
|
||||
nixos = (defaultNixosMods unstableInputs) ++ (unstableBundle.mods.nixos or []);
|
||||
};
|
||||
stableMods = {
|
||||
home = (defaultHomeMods stableInputs) ++ (stableBundle.mods.home or []);
|
||||
nixos = (defaultNixosMods stableInputs) ++ (stableBundle.mods.nixos or []);
|
||||
};
|
||||
|
||||
unstablePkgs = mkPkgs {
|
||||
pkgs = unstableInput;
|
||||
|
|
@ -132,7 +137,6 @@ in {
|
|||
additionalHomeConfig
|
||||
system
|
||||
root
|
||||
additionalInputs
|
||||
dashNixAdditionalProps
|
||||
lib
|
||||
;
|
||||
|
|
@ -148,10 +152,16 @@ in {
|
|||
then unstablePkgs
|
||||
else stablePkgs;
|
||||
hostName = name;
|
||||
homeMods = mods.home;
|
||||
additionalHomeMods = additionalMods.home;
|
||||
homeMods =
|
||||
if overridePkgs
|
||||
then unstableMods.home
|
||||
else stableMods.home;
|
||||
mkDashDefault = import ./override.nix {inherit lib;};
|
||||
};
|
||||
nixosMods =
|
||||
if overridePkgs
|
||||
then unstableMods.nixos
|
||||
else stableMods.nixos;
|
||||
in
|
||||
inputlib.nixosSystem {
|
||||
modules =
|
||||
|
|
@ -159,8 +169,7 @@ in {
|
|||
{_module.args = args;}
|
||||
mod
|
||||
]
|
||||
++ mods.nixos
|
||||
++ additionalMods.nixos
|
||||
++ nixosMods
|
||||
++ lib.optional (builtins.pathExists additionalNixosConfig) additionalNixosConfig
|
||||
++ lib.optional (builtins.pathExists mod) mod;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -37,7 +37,11 @@
|
|||
default = false;
|
||||
example = true;
|
||||
type = lib.types.bool;
|
||||
description = "Whether to use the CachyOS kernel. WARNING: This is a manual compiled kernel!";
|
||||
description = ''
|
||||
Whether to use the CachyOS kernel.
|
||||
WARNING: This is a manual compiled kernel!
|
||||
(Please also ensure you use your own input hash for the source as the compilation can often fail due to temporary broken changes.)
|
||||
'';
|
||||
};
|
||||
steam = lib.mkOption {
|
||||
default = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue