Merge nix-dendritic-example/main
This commit is contained in:
commit
ab53b268fa
19 changed files with 396 additions and 0 deletions
1
nix-dendritic-example/.ignore
Normal file
1
nix-dendritic-example/.ignore
Normal file
|
@ -0,0 +1 @@
|
|||
/.git/
|
99
nix-dendritic-example/flake.lock
generated
Normal file
99
nix-dendritic-example/flake.lock
generated
Normal file
|
@ -0,0 +1,99 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1753121425,
|
||||
"narHash": "sha256-TVcTNvOeWWk1DXljFxVRp+E0tzG1LhrVjOGGoMHuXio=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "644e0fc48951a860279da645ba77fe4a6e814c5e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1753180535,
|
||||
"narHash": "sha256-KEtlzMs2O7FDvciFtjk9W4hyau013Pj9qZNK9a0PxEc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "847711c7ffa9944b0c5c39a8342ac8eb6a9f9abc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "master",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"import-tree": {
|
||||
"locked": {
|
||||
"lastModified": 1752730890,
|
||||
"narHash": "sha256-GES8fapSLGz36MMPRVNkSUWXUTtqvGQNXHjRmRLfJUY=",
|
||||
"owner": "vic",
|
||||
"repo": "import-tree",
|
||||
"rev": "6ebb8cb87987b20264c09296166543fd3761d274",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "vic",
|
||||
"repo": "import-tree",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1752950548,
|
||||
"narHash": "sha256-NS6BLD0lxOrnCiEOcvQCDVPXafX1/ek1dfJHX1nUIzc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c87b95e25065c028d31a94f06a62927d18763fdf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1751159883,
|
||||
"narHash": "sha256-urW/Ylk9FIfvXfliA1ywh75yszAbiTEVgpPeinFyVZo=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "14a40a1d7fb9afa4739275ac642ed7301a9ba1ab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"home-manager": "home-manager",
|
||||
"import-tree": "import-tree",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
21
nix-dendritic-example/flake.nix
Normal file
21
nix-dendritic-example/flake.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
inputs = {
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
|
||||
home-manager = {
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
url = "github:nix-community/home-manager/master";
|
||||
};
|
||||
|
||||
import-tree.url = "github:vic/import-tree";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs:
|
||||
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [
|
||||
(inputs.import-tree ./modules)
|
||||
];
|
||||
};
|
||||
}
|
16
nix-dendritic-example/modules/eric.nix
Normal file
16
nix-dendritic-example/modules/eric.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
flake = {
|
||||
meta.eric.username = "eric";
|
||||
|
||||
modules = {
|
||||
nixos.eric = {
|
||||
users.users.${config.flake.meta.eric.username} = {
|
||||
isNormalUser = true;
|
||||
initialPassword = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
7
nix-dendritic-example/modules/flake-parts.nix
Normal file
7
nix-dendritic-example/modules/flake-parts.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.flake-parts.flakeModules.modules
|
||||
];
|
||||
}
|
7
nix-dendritic-example/modules/formatting.nix
Normal file
7
nix-dendritic-example/modules/formatting.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
formatter = pkgs.nixfmt-rfc-style;
|
||||
};
|
||||
}
|
12
nix-dendritic-example/modules/git.nix
Normal file
12
nix-dendritic-example/modules/git.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
flake.modules.homeManager.base = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
|
||||
userEmail = config.flake.meta.owner.email;
|
||||
userName = config.flake.meta.owner.name;
|
||||
};
|
||||
};
|
||||
}
|
2
nix-dendritic-example/modules/home-manager.nix
Normal file
2
nix-dendritic-example/modules/home-manager.nix
Normal file
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
14
nix-dendritic-example/modules/home-manager/base.nix
Normal file
14
nix-dendritic-example/modules/home-manager/base.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
flake.modules.homeManager.base = args: {
|
||||
home = {
|
||||
homeDirectory = "/home/${config.flake.meta.owner.username}";
|
||||
username = config.flake.meta.owner.username;
|
||||
};
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
systemd.user.startServices = "sd-switch";
|
||||
};
|
||||
}
|
28
nix-dendritic-example/modules/home-manager/nixos.nix
Normal file
28
nix-dendritic-example/modules/home-manager/nixos.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ config, inputs, ... }:
|
||||
|
||||
{
|
||||
flake.modules.nixos.pc = {
|
||||
imports = [ inputs.home-manager.nixosModules.home-manager ];
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
extraSpecialArgs.hasGlobalPkgs = true;
|
||||
|
||||
# https://github.com/nix-community/home-manager/issues/6770
|
||||
# useUserPackages = true;
|
||||
|
||||
users.${config.flake.meta.owner.username}.imports = [
|
||||
(
|
||||
{ osConfig, ... }:
|
||||
|
||||
{
|
||||
home.stateVersion = osConfig.system.stateVersion;
|
||||
}
|
||||
)
|
||||
|
||||
config.flake.modules.homeManager.base
|
||||
# config.flake.modules.homeManager.gui
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
66
nix-dendritic-example/modules/hosts/corgi/configuration.nix
Normal file
66
nix-dendritic-example/modules/hosts/corgi/configuration.nix
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
flake.modules.nixos."nixosConfigurations/corgi" =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
stateVersion,
|
||||
...
|
||||
}:
|
||||
{
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
time.timeZone = "Europe/London";
|
||||
|
||||
i18n.defaultLocale = "en_GB.UTF-8";
|
||||
|
||||
i18n.extraLocaleSettings = {
|
||||
LC_ADDRESS = "en_GB.UTF-8";
|
||||
LC_IDENTIFICATION = "en_GB.UTF-8";
|
||||
LC_MEASUREMENT = "en_GB.UTF-8";
|
||||
LC_MONETARY = "en_GB.UTF-8";
|
||||
LC_NAME = "en_GB.UTF-8";
|
||||
LC_NUMERIC = "en_GB.UTF-8";
|
||||
LC_PAPER = "en_GB.UTF-8";
|
||||
LC_TELEPHONE = "en_GB.UTF-8";
|
||||
LC_TIME = "en_GB.UTF-8";
|
||||
};
|
||||
|
||||
services.xserver.enable = true;
|
||||
|
||||
services.xserver.displayManager.lightdm.enable = true;
|
||||
services.xserver.desktopManager.cinnamon.enable = true;
|
||||
|
||||
services.xserver.xkb = {
|
||||
layout = "gb";
|
||||
variant = "";
|
||||
};
|
||||
|
||||
console.keyMap = "uk";
|
||||
|
||||
services.printing.enable = true;
|
||||
|
||||
services.pulseaudio.enable = false;
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
|
||||
};
|
||||
|
||||
programs.firefox.enable = true;
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
];
|
||||
|
||||
services.openssh.enable = true;
|
||||
|
||||
system.stateVersion = stateVersion;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
flake.modules.nixos."nixosConfigurations/corgi" =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"ahci"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sr_mod"
|
||||
"rtsx_usb_sdmmc"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/076c5319-e9b6-4985-b86b-5b4287be17ba";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/E090-18D3";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"fmask=0077"
|
||||
"dmask=0077"
|
||||
];
|
||||
};
|
||||
|
||||
swapDevices = [
|
||||
{ device = "/dev/disk/by-uuid/b29480eb-56cf-4353-9b98-790e4e2512b3"; }
|
||||
];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
};
|
||||
}
|
8
nix-dendritic-example/modules/hosts/corgi/imports.nix
Normal file
8
nix-dendritic-example/modules/hosts/corgi/imports.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
flake.modules.nixos."nixosConfigurations/corgi".imports = with config.flake.modules.nixos; [
|
||||
eric
|
||||
pc
|
||||
];
|
||||
}
|
7
nix-dendritic-example/modules/meta-output.nix
Normal file
7
nix-dendritic-example/modules/meta-output.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
options.flake.meta = lib.mkOption {
|
||||
type = lib.types.anything;
|
||||
};
|
||||
}
|
13
nix-dendritic-example/modules/nixos-configurations.nix
Normal file
13
nix-dendritic-example/modules/nixos-configurations.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ config, inputs, ... }:
|
||||
|
||||
{
|
||||
flake.nixosConfigurations.corgi = inputs.nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
|
||||
modules = [ config.flake.modules.nixos."nixosConfigurations/corgi" ];
|
||||
|
||||
specialArgs = {
|
||||
stateVersion = "25.05";
|
||||
};
|
||||
};
|
||||
}
|
23
nix-dendritic-example/modules/owner.nix
Normal file
23
nix-dendritic-example/modules/owner.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
flake = {
|
||||
meta.owner = {
|
||||
email = "oliver@oliverdavies.uk";
|
||||
name = "Oliver Davies";
|
||||
username = "opdavies";
|
||||
};
|
||||
|
||||
modules = {
|
||||
nixos.pc = {
|
||||
users.users.${config.flake.meta.owner.username} = {
|
||||
isNormalUser = true;
|
||||
initialPassword = "";
|
||||
extraGroups = [ "input" "wheel" ];
|
||||
};
|
||||
|
||||
nix.settings.trusted-users = [ config.flake.meta.owner.username ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
8
nix-dendritic-example/modules/systems.nix
Normal file
8
nix-dendritic-example/modules/systems.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"aarch64-darwin"
|
||||
"x86_64-darwin"
|
||||
];
|
||||
}
|
5
nix-dendritic-example/modules/tmux.nix
Normal file
5
nix-dendritic-example/modules/tmux.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
flake.modules.homeManager.base = {
|
||||
programs.tmux.enable = true;
|
||||
};
|
||||
}
|
2
nix-dendritic-example/todo.txt
Normal file
2
nix-dendritic-example/todo.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
add home manager
|
||||
switch git to use home manager
|
Loading…
Add table
Add a link
Reference in a new issue