mirror of
https://gitlab.com/rensa-nix/utils.git
synced 2025-12-10 22:50:12 +01:00
chore: initial commit
This commit is contained in:
commit
e832157e68
14 changed files with 666 additions and 0 deletions
2
.envrc
Normal file
2
.envrc
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
source $(fetchurl https://gitlab.com/rensa-nix/direnv/-/raw/v0.3.0/direnvrc "sha256-u7+KEz684NnIZ+Vh5x5qLrt8rKdnUNexewBoeTcEVHQ=")
|
||||
use ren //repo/devShells/default
|
||||
63
flake.lock
generated
Normal file
63
flake.lock
generated
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1759381078,
|
||||
"narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1754184128,
|
||||
"narHash": "sha256-AjhoyBL4eSyXf01Bmc6DiuaMrJRNdWopmdnMY0Pa/M0=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "02e72200e6d56494f4a7c0da8118760736e41b60",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"ren": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1758738378,
|
||||
"narHash": "sha256-NjzqdvQCDDdObEBH8x/vdhbdhrIB+N9E570uCdksGHY=",
|
||||
"owner": "rensa-nix",
|
||||
"repo": "core",
|
||||
"rev": "abe19f9f13aff41de2b63304545c87d193d19ef4",
|
||||
"type": "gitlab"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "rensa-nix",
|
||||
"repo": "core",
|
||||
"type": "gitlab"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"ren": "ren"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
22
flake.nix
Normal file
22
flake.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
ren.url = "gitlab:rensa-nix/core?dir=lib";
|
||||
};
|
||||
|
||||
outputs = {ren, ...} @ inputs:
|
||||
ren.buildWith
|
||||
{
|
||||
inherit inputs;
|
||||
cellsFrom = ./nix;
|
||||
transformInputs = system: i:
|
||||
i
|
||||
// {
|
||||
pkgs = import i.nixpkgs {inherit system;};
|
||||
};
|
||||
cellBlocks = with ren.blocks; [
|
||||
(simple "devShells")
|
||||
];
|
||||
}
|
||||
{};
|
||||
}
|
||||
5
lib/default.nix
Normal file
5
lib/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
args: {
|
||||
mkSystem = import ./mkSystem.nix args;
|
||||
mkHome = import ./mkHome.nix args;
|
||||
mkDisk = import ./mkDisk.nix args;
|
||||
}
|
||||
5
lib/flake.nix
Normal file
5
lib/flake.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
outputs = i: {
|
||||
lib = import ./.;
|
||||
};
|
||||
}
|
||||
32
lib/mkDisk.nix
Normal file
32
lib/mkDisk.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{lib}: userConfig: let
|
||||
inherit (lib) evalModules types assertMsg isAttrs;
|
||||
|
||||
evaled = evalModules {
|
||||
modules = [
|
||||
./ren-module.nix
|
||||
userConfig
|
||||
{
|
||||
config._module.check = true;
|
||||
config._module.freeformType = types.unspecified;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
disko = assert assertMsg (isAttrs evaled.config.ren.disko) "disko input unset"; evaled.config.ren.disko;
|
||||
diskoLib = import "${disko}/lib" {inherit lib;};
|
||||
|
||||
diskConfig = evalModules {
|
||||
modules = [
|
||||
./ren-module.nix
|
||||
userConfig
|
||||
{
|
||||
# required since its a type, not a module
|
||||
freeformType = diskoLib.toplevel;
|
||||
}
|
||||
];
|
||||
};
|
||||
in {
|
||||
innerConfig = builtins.removeAttrs diskConfig.config ["ren"];
|
||||
inherit (diskConfig) config options;
|
||||
scripts = diskConfig.config._scripts {inherit (evaled.config.ren) pkgs;};
|
||||
}
|
||||
35
lib/mkHome.nix
Normal file
35
lib/mkHome.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{lib}: userConfig: let
|
||||
inherit (lib) evalModules types assertMsg isAttrs toString;
|
||||
evaled = evalModules {
|
||||
modules = [
|
||||
./ren-module.nix
|
||||
userConfig
|
||||
{
|
||||
config._module.check = true;
|
||||
config._module.freeformType = types.unspecified;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
home-manager = assert assertMsg (isAttrs evaled.config.ren.home-manager) "home-manager input unset"; evaled.config.ren.home-manager;
|
||||
hmLib = import (home-manager + /modules/lib/stdlib-extended.nix) lib;
|
||||
hmModules = import (home-manager + /modules/modules.nix) {
|
||||
inherit (evaled.config.ren) pkgs;
|
||||
lib = hmLib;
|
||||
check = true;
|
||||
useNixpkgsModule = false;
|
||||
};
|
||||
|
||||
homeConfig = hmLib.evalModules {
|
||||
specialArgs = {
|
||||
modulesPath = toString (evaled.config.bee.home + /modules);
|
||||
};
|
||||
modules = [./ren-module.nix userConfig] ++ hmModules;
|
||||
};
|
||||
in {
|
||||
innerConfig = {
|
||||
imports = [userConfig ./ren-module.nix];
|
||||
};
|
||||
inherit (homeConfig) options config;
|
||||
inherit (homeConfig.config.home) activationPackage;
|
||||
}
|
||||
77
lib/mkSystem.nix
Normal file
77
lib/mkSystem.nix
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
{lib}: userConfig: let
|
||||
inherit (lib) evalModules types assertMsg isAttrs optionals mkDefault;
|
||||
|
||||
evaled = evalModules {
|
||||
modules = [
|
||||
./ren-module.nix
|
||||
userConfig
|
||||
{
|
||||
config._module.check = true;
|
||||
config._module.freeformType = types.unspecified;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
isDarwin = evaled.options.ren.nix-darwin.isDefined;
|
||||
nix-darwin = assert assertMsg (isAttrs evaled.config.ren.nix-darwin) "nix-darwin input unset"; evaled.config.ren.nix-darwin;
|
||||
|
||||
baseModules = [./ren-module.nix userConfig];
|
||||
|
||||
nixosModules = import (evaled.config.ren.pkgs.path + "/nixos/modules/module-list.nix");
|
||||
darwinModules = import (evaled.config.ren.nix-darwin + "/modules/module-list.nix");
|
||||
|
||||
extraNixosConfig = {
|
||||
nixpkgs = {
|
||||
inherit (evaled.config.ren) system pkgs;
|
||||
};
|
||||
imports =
|
||||
# add home-manager if the input is passed
|
||||
optionals (evaled.options.ren.home-manager.isDefined) [
|
||||
evaled.config.ren.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = mkDefault true;
|
||||
home-manager.useUserPackages = mkDefault false;
|
||||
}
|
||||
]
|
||||
# add nixos-wsl if the input is passed
|
||||
++ optionals (evaled.options.ren.nixos-wsl.isDefined) [
|
||||
evaled.config.ren.nixos-wsl.nixosModules.wsl
|
||||
{
|
||||
wsl.enable = mkDefault true;
|
||||
}
|
||||
]
|
||||
# add disko if the input is passed
|
||||
++ optionals (evaled.options.ren.disko.isDefined) [
|
||||
evaled.config.ren.disko.nixosModules.disko
|
||||
];
|
||||
};
|
||||
extraDarwinConfig = {
|
||||
# add home-manager if the input is passed
|
||||
imports = optionals (evaled.options.ren.home-manager.isDefined) [
|
||||
evaled.config.ren.home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = mkDefault true;
|
||||
home-manager.useUserPackages = mkDefault false;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
systemConfig = import (evaled.config.ren.pkgs.path + "/nixos/lib/eval-config.nix") {
|
||||
system = null;
|
||||
modules = baseModules ++ [extraNixosConfig] ++ nixosModules;
|
||||
};
|
||||
darwinConfig = nix-darwin.lib.darwinSystem {
|
||||
inherit (evaled.config.ren) system pkgs;
|
||||
modules = baseModules ++ [extraDarwinConfig] ++ darwinModules;
|
||||
};
|
||||
in
|
||||
(
|
||||
if isDarwin
|
||||
then darwinConfig
|
||||
else systemConfig
|
||||
)
|
||||
// {
|
||||
innerConfig = {
|
||||
imports = [userConfig ./ren-module.nix];
|
||||
};
|
||||
}
|
||||
50
lib/ren-module.nix
Normal file
50
lib/ren-module.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkOption mkOptionType types isAttrs hasAttr;
|
||||
mkInputOption = description:
|
||||
mkOption {
|
||||
type = mkOptionType {
|
||||
name = "input";
|
||||
description = "a flake input";
|
||||
check = x: (isAttrs x) && (hasAttr "sourceInfo" x);
|
||||
};
|
||||
description = ''
|
||||
The flake input for ${description}.
|
||||
|
||||
Example:
|
||||
ren.home-manager = inputs.home-manager;
|
||||
'';
|
||||
};
|
||||
in {
|
||||
options.ren = {
|
||||
system = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
The system architecture (e.g., 'x86_64-linux', 'aarch64-darwin').
|
||||
'';
|
||||
};
|
||||
|
||||
home-manager = mkInputOption "Home Manager";
|
||||
disko = mkInputOption "Disko";
|
||||
nixos-wsl = mkInputOption "NixOS-WSL";
|
||||
nix-darwin = mkInputOption "nix-darwin";
|
||||
|
||||
pkgs = mkOption {
|
||||
type = mkOptionType {
|
||||
name = "packages";
|
||||
description = "instance of nixpkgs";
|
||||
check = x: (isAttrs x) && (hasAttr "path" x);
|
||||
};
|
||||
description = ''
|
||||
An instantiated nixpkgs set. Used for general pkgs and to get NixOS systems' modules.
|
||||
'';
|
||||
apply = x:
|
||||
if (hasAttr "${config.ren.system or "unset"}" x)
|
||||
then x.${config.ren.system}
|
||||
else x;
|
||||
};
|
||||
};
|
||||
}
|
||||
16
nix/repo/devShells.nix
Normal file
16
nix/repo/devShells.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{inputs, ...}: let
|
||||
inherit (inputs) pkgs devshell treefmt;
|
||||
in {
|
||||
default = devshell.mkShell {
|
||||
packages = [
|
||||
pkgs.nil
|
||||
(treefmt.mkWrapper pkgs {
|
||||
programs = {
|
||||
alejandra.enable = true;
|
||||
deadnix.enable = true;
|
||||
mdformat.enable = true;
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
45
nix/repo/flake.lock
generated
Normal file
45
nix/repo/flake.lock
generated
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"nodes": {
|
||||
"devshell-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1758204313,
|
||||
"narHash": "sha256-ainbY0Oajb1HMdvy+A8QxF/P5qwcbEzJGEY5pzKdDdc=",
|
||||
"owner": "rensa-nix",
|
||||
"repo": "devshell",
|
||||
"rev": "7d0c4bc78d9f017a739b0c7eb2f4e563118353e6",
|
||||
"type": "gitlab"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "rensa-nix",
|
||||
"repo": "devshell",
|
||||
"type": "gitlab"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devshell-lib": "devshell-lib",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1758728421,
|
||||
"narHash": "sha256-ySNJ008muQAds2JemiyrWYbwbG+V7S5wg3ZVKGHSFu8=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "5eda4ee8121f97b218f7cc73f5172098d458f1d1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
15
nix/repo/flake.nix
Normal file
15
nix/repo/flake.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
inputs = {
|
||||
devshell-lib.url = "gitlab:rensa-nix/devshell?dir=lib";
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
outputs = i:
|
||||
i
|
||||
// {
|
||||
devshell = i.devshell-lib.lib {inherit (i.parent) pkgs;};
|
||||
treefmt = import i.treefmt-nix;
|
||||
};
|
||||
}
|
||||
184
test/flake.lock
generated
Normal file
184
test/flake.lock
generated
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
{
|
||||
"nodes": {
|
||||
"disko": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1758287904,
|
||||
"narHash": "sha256-IGmaEf3Do8o5Cwp1kXBN1wQmZwQN3NLfq5t4nHtVtcU=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "67ff9807dd148e704baadbd4fd783b54282ca627",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1747046372,
|
||||
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1759337100,
|
||||
"narHash": "sha256-CcT3QvZ74NGfM+lSOILcCEeU+SnqXRvl1XCRHenZ0Us=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "004753ae6b04c4b18aa07192c1106800aaacf6c3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1758805352,
|
||||
"narHash": "sha256-BHdc43Lkayd+72W/NXRKHzX5AZ+28F3xaUs3a88/Uew=",
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "c48e963a5558eb1c3827d59d21c5193622a1477c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-wsl": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1759348509,
|
||||
"narHash": "sha256-at9xMhxMP65JYWlGWYJ412VKbS+tXkTM3f5t9Q8IyMA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-wsl",
|
||||
"rev": "d96dda76c1f1827634ddf28d386feabd2d135d21",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-wsl",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1752596105,
|
||||
"narHash": "sha256-lFNVsu/mHLq3q11MuGkMhUUoSXEdQjCHvpReaGP1S2k=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "dab3a6e781554f965bde3def0aa2fda4eb8f1708",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1759036355,
|
||||
"narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1747728033,
|
||||
"narHash": "sha256-NnXFQu7g4LnvPIPfJmBuZF7LFy/fey2g2+LCzjQhTUk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2f9173bde1d3fbf1ad26ff6d52f952f9e9da52ea",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1759036355,
|
||||
"narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1759036355,
|
||||
"narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"disko": "disko",
|
||||
"home-manager": "home-manager",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nixos-wsl": "nixos-wsl",
|
||||
"nixpkgs": "nixpkgs_5"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
115
test/flake.nix
Normal file
115
test/flake.nix
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
disko.url = "github:nix-community/disko";
|
||||
nixos-wsl.url = "github:nix-community/nixos-wsl";
|
||||
nix-darwin.url = "github:lnl7/nix-darwin";
|
||||
};
|
||||
|
||||
outputs = {...} @ inputs: let
|
||||
lib = import ../lib {inherit (inputs.nixpkgs) lib;};
|
||||
pkgs = inputs.nixpkgs.legacyPackages.aarch64-linux;
|
||||
in rec {
|
||||
nixosConfigurations = {
|
||||
"nixos-server" = lib.mkSystem {
|
||||
ren = {
|
||||
system = "aarch64-linux";
|
||||
inherit pkgs;
|
||||
inherit (inputs) home-manager disko;
|
||||
};
|
||||
|
||||
networking.hostName = "nixos-server";
|
||||
users.users."demo" = {
|
||||
home = "/home/demo";
|
||||
isNormalUser = true;
|
||||
group = "example";
|
||||
};
|
||||
users.groups."example" = {};
|
||||
|
||||
disko.devices = pkgs.lib.mkMerge [
|
||||
diskoConfigurations.some-disk.innerConfig
|
||||
];
|
||||
|
||||
home-manager = {
|
||||
useUserPackages = false;
|
||||
useGlobalPkgs = true;
|
||||
users.demo = homeConfigurations."demo-standalone".innerConfig;
|
||||
};
|
||||
};
|
||||
|
||||
"nixos-wsl" = lib.mkSystem {
|
||||
ren = {
|
||||
system = "x86_64-linux";
|
||||
inherit pkgs;
|
||||
inherit (inputs) nixos-wsl;
|
||||
};
|
||||
|
||||
wsl.defaultUser = "demo";
|
||||
};
|
||||
};
|
||||
|
||||
darwinConfigurations = {
|
||||
"my-macbook" = lib.mkSystem {
|
||||
ren = {
|
||||
system = "aarch64-darwin";
|
||||
inherit pkgs;
|
||||
inherit (inputs) nix-darwin;
|
||||
};
|
||||
system.stateVersion = 6;
|
||||
users.users.demo.home = "/Users/demo";
|
||||
};
|
||||
};
|
||||
|
||||
diskoConfigurations = {
|
||||
"some-disk" = lib.mkDisk {
|
||||
disk = {
|
||||
sda = {
|
||||
device = "/dev/sda";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
attributes = [0];
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
ren = {
|
||||
inherit pkgs;
|
||||
inherit (inputs) disko;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
homeConfigurations = {
|
||||
"demo-standalone" = lib.mkHome {
|
||||
ren = rec {
|
||||
system = "x86_64-linux";
|
||||
inherit (inputs) home-manager;
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
home = {
|
||||
username = "demo";
|
||||
homeDirectory = "/home/demo";
|
||||
stateVersion = "23.11";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue