fixes
This commit is contained in:
6
flake.lock
generated
6
flake.lock
generated
@@ -1063,11 +1063,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_13": {
|
"nixpkgs_13": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1756542300,
|
"lastModified": 1756787288,
|
||||||
"narHash": "sha256-tlOn88coG5fzdyqz6R93SQL5Gpq+m/DsWpekNFhqPQk=",
|
"narHash": "sha256-rw/PHa1cqiePdBxhF66V7R+WAP8WekQ0mCDG4CFqT8Y=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d7600c775f877cd87b4f5a831c28aa94137377aa",
|
"rev": "d0fc30899600b9b3466ddb260fd83deb486c32f1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -263,10 +263,10 @@
|
|||||||
|
|
||||||
outputs-builder = channels: {
|
outputs-builder = channels: {
|
||||||
formatter = inputs.treefmt-nix.lib.mkWrapper channels.nixpkgs ./treefmt.nix;
|
formatter = inputs.treefmt-nix.lib.mkWrapper channels.nixpkgs ./treefmt.nix;
|
||||||
|
|
||||||
# Add mjallen-lib to the flake outputs
|
# Add mjallen-lib to the flake outputs
|
||||||
overlays = {
|
overlays = {
|
||||||
mjallen-lib = final: prev: {
|
mjallen-lib = _final: _prev: {
|
||||||
mjallen-lib = (import ./lib { inherit inputs; }).mjallen-lib;
|
mjallen-lib = (import ./lib { inherit inputs; }).mjallen-lib;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ in
|
|||||||
home.stateVersion = "23.11";
|
home.stateVersion = "23.11";
|
||||||
|
|
||||||
mjallen = {
|
mjallen = {
|
||||||
desktop.hyprland = {
|
programs.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
primaryDisplay = "eDP-1";
|
primaryDisplay = "eDP-1";
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
mjallen-lib = {
|
mjallen-lib = {
|
||||||
# Import module utilities
|
# Import module utilities
|
||||||
module = import ./module { inherit inputs; };
|
module = import ./module { inherit inputs; };
|
||||||
|
|
||||||
# Import file utilities
|
# Import file utilities
|
||||||
file = import ./file { inherit inputs; };
|
file = import ./file { inherit inputs; };
|
||||||
|
|
||||||
# Import system utilities
|
# Import system utilities
|
||||||
system = import ./system { inherit inputs; };
|
system = import ./system { inherit inputs; };
|
||||||
|
|
||||||
# Import examples
|
# Import examples
|
||||||
examples = import ./examples { inherit inputs; };
|
examples = import ./examples { inherit inputs; };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ inputs, ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
# Import all examples
|
# Import all examples
|
||||||
sops = import ./sops.nix;
|
sops = import ./sops.nix;
|
||||||
|
|||||||
@@ -1,46 +1,47 @@
|
|||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib.mjallen.file)
|
inherit (lib.mjallen.file)
|
||||||
readFile
|
readFile
|
||||||
pathExists
|
pathExists
|
||||||
safeImport
|
safeImport
|
||||||
scanDir
|
scanDir
|
||||||
getFile
|
getFile
|
||||||
importModulesRecursive
|
importModulesRecursive
|
||||||
scanSystems
|
scanSystems
|
||||||
filterNixOSSystems
|
filterNixOSSystems
|
||||||
filterDarwinSystems
|
filterDarwinSystems
|
||||||
scanHomes;
|
scanHomes
|
||||||
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Example of reading a file
|
# Example of reading a file
|
||||||
myFileContent = readFile ./example.txt;
|
myFileContent = readFile ./example.txt;
|
||||||
|
|
||||||
# Example of checking if a file exists
|
# Example of checking if a file exists
|
||||||
fileExists = pathExists ./example.txt;
|
fileExists = pathExists ./example.txt;
|
||||||
|
|
||||||
# Example of safely importing a file
|
# Example of safely importing a file
|
||||||
myConfig = safeImport ./my-config.nix {};
|
myConfig = safeImport ./my-config.nix { };
|
||||||
|
|
||||||
# Example of scanning a directory
|
# Example of scanning a directory
|
||||||
directoryContents = scanDir ./modules;
|
directoryContents = scanDir ./modules;
|
||||||
|
|
||||||
# Example of getting a file path relative to the flake root
|
# Example of getting a file path relative to the flake root
|
||||||
flakeFile = getFile "flake.nix";
|
flakeFile = getFile "flake.nix";
|
||||||
|
|
||||||
# Example of importing modules recursively
|
# Example of importing modules recursively
|
||||||
modules = importModulesRecursive ./modules;
|
modules = importModulesRecursive ./modules;
|
||||||
|
|
||||||
# Example of scanning systems
|
# Example of scanning systems
|
||||||
allSystems = scanSystems ./systems;
|
allSystems = scanSystems ./systems;
|
||||||
|
|
||||||
# Example of filtering systems
|
# Example of filtering systems
|
||||||
nixosSystems = filterNixOSSystems allSystems;
|
nixosSystems = filterNixOSSystems allSystems;
|
||||||
darwinSystems = filterDarwinSystems allSystems;
|
darwinSystems = filterDarwinSystems allSystems;
|
||||||
|
|
||||||
# Example of scanning homes
|
# Example of scanning homes
|
||||||
allHomes = scanHomes ./homes;
|
allHomes = scanHomes ./homes;
|
||||||
|
|
||||||
# Example of using these functions together
|
# Example of using these functions together
|
||||||
nixosConfigurations = lib.mapAttrs' (
|
nixosConfigurations = lib.mapAttrs' (
|
||||||
name:
|
name:
|
||||||
@@ -51,7 +52,8 @@ in
|
|||||||
inherit system;
|
inherit system;
|
||||||
modules = [
|
modules = [
|
||||||
{ networking.hostName = hostname; }
|
{ networking.hostName = hostname; }
|
||||||
] ++ importModulesRecursive ./modules/nixos;
|
]
|
||||||
|
++ importModulesRecursive ./modules/nixos;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
) nixosSystems;
|
) nixosSystems;
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib.mjallen.module) mkModule mkOpt mkBoolOpt;
|
inherit (lib.mjallen.module) mkModule mkOpt;
|
||||||
in
|
in
|
||||||
mkModule {
|
mkModule {
|
||||||
name = "sops";
|
name = "sops";
|
||||||
description = "SOPS secret management for home-manager";
|
description = "SOPS secret management for home-manager";
|
||||||
options = {
|
options = {
|
||||||
defaultSopsFile = mkOpt lib.types.path null "Default sops file.";
|
defaultSopsFile = mkOpt lib.types.path null "Default sops file.";
|
||||||
|
|
||||||
sshKeyPaths = mkOpt (lib.types.listOf lib.types.str) [] "SSH Key paths to use.";
|
sshKeyPaths = mkOpt (lib.types.listOf lib.types.str) [ ] "SSH Key paths to use.";
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
|||||||
@@ -7,15 +7,17 @@ mkModule {
|
|||||||
description = "SOPS secret management";
|
description = "SOPS secret management";
|
||||||
options = {
|
options = {
|
||||||
defaultSopsFile = mkOpt lib.types.path null "Default sops file.";
|
defaultSopsFile = mkOpt lib.types.path null "Default sops file.";
|
||||||
|
|
||||||
generateAgeKey = mkBoolOpt true "Whether to automatically generate an age key if one doesn't exist.";
|
generateAgeKey = mkBoolOpt true "Whether to automatically generate an age key if one doesn't exist.";
|
||||||
|
|
||||||
ageKeyPath = mkOpt (lib.types.nullOr lib.types.str) null "Custom path to the age key file. If null, will use the default path.";
|
ageKeyPath =
|
||||||
|
mkOpt (lib.types.nullOr lib.types.str) null
|
||||||
|
"Custom path to the age key file. If null, will use the default path.";
|
||||||
|
|
||||||
sshKeyPaths = mkOpt (lib.types.listOf lib.types.str) [
|
sshKeyPaths = mkOpt (lib.types.listOf lib.types.str) [
|
||||||
"/etc/ssh/ssh_host_ed25519_key"
|
"/etc/ssh/ssh_host_ed25519_key"
|
||||||
] "SSH Key paths to use.";
|
] "SSH Key paths to use.";
|
||||||
|
|
||||||
validateSopsFiles = mkBoolOpt false "Whether to validate that sops files exist.";
|
validateSopsFiles = mkBoolOpt false "Whether to validate that sops files exist.";
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
@@ -24,11 +26,13 @@ mkModule {
|
|||||||
|
|
||||||
age = {
|
age = {
|
||||||
inherit (config.mjallen.sops) generateAgeKey;
|
inherit (config.mjallen.sops) generateAgeKey;
|
||||||
|
|
||||||
keyFile = if config.mjallen.sops.ageKeyPath != null
|
keyFile =
|
||||||
then config.mjallen.sops.ageKeyPath
|
if config.mjallen.sops.ageKeyPath != null then
|
||||||
else "${config.users.users.${config.mjallen.user.name}.home}/.config/sops/age/keys.txt";
|
config.mjallen.sops.ageKeyPath
|
||||||
|
else
|
||||||
|
"${config.users.users.${config.mjallen.user.name}.home}/.config/sops/age/keys.txt";
|
||||||
|
|
||||||
sshKeyPaths = config.mjallen.sops.sshKeyPaths;
|
sshKeyPaths = config.mjallen.sops.sshKeyPaths;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
let
|
let
|
||||||
inherit (inputs.self.mjallen-lib.system.common)
|
inherit (inputs.self.mjallen-lib.system.common)
|
||||||
mkExtendedLib
|
mkExtendedLib
|
||||||
mkNixpkgsConfig
|
mkNixpkgsConfig
|
||||||
mkHomeConfigs
|
mkHomeConfigs
|
||||||
mkHomeManagerConfig
|
mkHomeManagerConfig
|
||||||
mkSpecialArgs;
|
mkSpecialArgs
|
||||||
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Example of creating NixOS configurations
|
# Example of creating NixOS configurations
|
||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
let
|
let
|
||||||
# Get all systems
|
# Get all systems
|
||||||
allSystems = inputs.self.mjallen-lib.file.scanSystems ../systems;
|
allSystems = inputs.self.mjallen-lib.file.scanSystems ../systems;
|
||||||
|
|
||||||
# Filter for NixOS systems
|
# Filter for NixOS systems
|
||||||
nixosSystems = inputs.self.mjallen-lib.file.filterNixOSSystems allSystems;
|
nixosSystems = inputs.self.mjallen-lib.file.filterNixOSSystems allSystems;
|
||||||
in
|
in
|
||||||
@@ -23,16 +24,21 @@ in
|
|||||||
let
|
let
|
||||||
# Create extended lib with mjallen-lib
|
# Create extended lib with mjallen-lib
|
||||||
extendedLib = mkExtendedLib inputs.self inputs.nixpkgs;
|
extendedLib = mkExtendedLib inputs.self inputs.nixpkgs;
|
||||||
|
|
||||||
# Find matching home configurations for this system
|
# Find matching home configurations for this system
|
||||||
matchingHomes = mkHomeConfigs {
|
matchingHomes = mkHomeConfigs {
|
||||||
flake = inputs.self;
|
flake = inputs.self;
|
||||||
inherit system hostname;
|
inherit system hostname;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Create home-manager configuration
|
# Create home-manager configuration
|
||||||
homeManagerConfig = mkHomeManagerConfig {
|
homeManagerConfig = mkHomeManagerConfig {
|
||||||
inherit extendedLib inputs system matchingHomes;
|
inherit
|
||||||
|
extendedLib
|
||||||
|
inputs
|
||||||
|
system
|
||||||
|
matchingHomes
|
||||||
|
;
|
||||||
isNixOS = true;
|
isNixOS = true;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@@ -40,46 +46,55 @@ in
|
|||||||
name = hostname;
|
name = hostname;
|
||||||
value = inputs.nixpkgs.lib.nixosSystem {
|
value = inputs.nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
|
||||||
# Pass special arguments to modules
|
# Pass special arguments to modules
|
||||||
specialArgs = mkSpecialArgs {
|
specialArgs = mkSpecialArgs {
|
||||||
inherit inputs hostname extendedLib;
|
inherit inputs hostname extendedLib;
|
||||||
username = "mjallen";
|
username = "mjallen";
|
||||||
};
|
};
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
# Set lib to extended lib
|
# Set lib to extended lib
|
||||||
{ _module.args.lib = extendedLib; }
|
{ _module.args.lib = extendedLib; }
|
||||||
|
|
||||||
# Configure nixpkgs
|
# Configure nixpkgs
|
||||||
{
|
{
|
||||||
nixpkgs = {
|
nixpkgs = {
|
||||||
inherit system;
|
inherit system;
|
||||||
} // mkNixpkgsConfig inputs.self;
|
}
|
||||||
|
// mkNixpkgsConfig inputs.self;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Import home-manager module
|
# Import home-manager module
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
|
||||||
# Auto-inject home configurations
|
# Auto-inject home configurations
|
||||||
homeManagerConfig
|
homeManagerConfig
|
||||||
|
|
||||||
# Import all nixos modules recursively
|
# Import all nixos modules recursively
|
||||||
../${system}/${hostname}
|
../${system}/${hostname}
|
||||||
] ++ (extendedLib.mjallen.file.importModulesRecursive ../modules/nixos);
|
]
|
||||||
|
++ (extendedLib.mjallen.file.importModulesRecursive ../modules/nixos);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
) nixosSystems;
|
) nixosSystems;
|
||||||
|
|
||||||
# Example of creating home-manager configurations
|
# Example of creating home-manager configurations
|
||||||
homeConfigurations =
|
homeConfigurations =
|
||||||
let
|
let
|
||||||
# Get all homes
|
# Get all homes
|
||||||
allHomes = inputs.self.mjallen-lib.file.scanHomes ../homes;
|
allHomes = inputs.self.mjallen-lib.file.scanHomes ../homes;
|
||||||
in
|
in
|
||||||
inputs.nixpkgs.lib.mapAttrs' (
|
inputs.nixpkgs.lib.mapAttrs' (
|
||||||
name:
|
name:
|
||||||
{ system, username, hostname, userAtHost, path, ... }:
|
{
|
||||||
|
system,
|
||||||
|
username,
|
||||||
|
hostname,
|
||||||
|
userAtHost,
|
||||||
|
path,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
# Create extended lib with mjallen-lib
|
# Create extended lib with mjallen-lib
|
||||||
extendedLib = mkExtendedLib inputs.self inputs.nixpkgs;
|
extendedLib = mkExtendedLib inputs.self inputs.nixpkgs;
|
||||||
@@ -91,20 +106,26 @@ in
|
|||||||
inherit system;
|
inherit system;
|
||||||
inherit ((mkNixpkgsConfig inputs.self)) config overlays;
|
inherit ((mkNixpkgsConfig inputs.self)) config overlays;
|
||||||
};
|
};
|
||||||
|
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
inherit inputs hostname username system;
|
inherit
|
||||||
|
inputs
|
||||||
|
hostname
|
||||||
|
username
|
||||||
|
system
|
||||||
|
;
|
||||||
inherit (inputs) self;
|
inherit (inputs) self;
|
||||||
lib = extendedLib;
|
lib = extendedLib;
|
||||||
};
|
};
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
# Set lib to extended lib
|
# Set lib to extended lib
|
||||||
{ _module.args.lib = extendedLib; }
|
{ _module.args.lib = extendedLib; }
|
||||||
|
|
||||||
# Import the home configuration
|
# Import the home configuration
|
||||||
path
|
path
|
||||||
] ++ (extendedLib.mjallen.file.importModulesRecursive ../modules/home);
|
]
|
||||||
|
++ (extendedLib.mjallen.file.importModulesRecursive ../modules/home);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
) allHomes;
|
) allHomes;
|
||||||
|
|||||||
@@ -3,9 +3,13 @@ let
|
|||||||
inherit (inputs.nixpkgs.lib) filterAttrs mapAttrs';
|
inherit (inputs.nixpkgs.lib) filterAttrs mapAttrs';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
mkExtendedLib = flake: nixpkgs: nixpkgs.lib.extend (final: prev: {
|
mkExtendedLib =
|
||||||
mjallen = flake.mjallen-lib;
|
flake: nixpkgs:
|
||||||
});
|
nixpkgs.lib.extend (
|
||||||
|
_final: _prev: {
|
||||||
|
mjallen = flake.mjallen-lib;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
mkNixpkgsConfig = flake: {
|
mkNixpkgsConfig = flake: {
|
||||||
overlays = builtins.attrValues flake.overlays;
|
overlays = builtins.attrValues flake.overlays;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
namespace,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|||||||
@@ -1,35 +1,69 @@
|
|||||||
{
|
{
|
||||||
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
system,
|
system,
|
||||||
lib,
|
lib,
|
||||||
|
namespace,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
with lib;
|
||||||
let
|
let
|
||||||
|
inherit (lib.${namespace}) mkOpt mkBoolOpt;
|
||||||
|
cfg = config.${namespace}.boot.common;
|
||||||
isArm = ("aarch64-linux" == system) || ("aarch64-darwin" == system);
|
isArm = ("aarch64-linux" == system) || ("aarch64-darwin" == system);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
boot = {
|
options.${namespace}.boot.common = {
|
||||||
kernelParams = [
|
enable = mkBoolOpt true "Enable common boot stuff";
|
||||||
"quiet"
|
|
||||||
];
|
|
||||||
|
|
||||||
binfmt = lib.mkIf isArm {
|
yubikeyEncryption = mkBoolOpt false "Enable Yubikey root encryption";
|
||||||
registrations."x86_64-linux" = {
|
|
||||||
magicOrExtension = ''\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00'';
|
yubikeyGracePeriod = mkOpt types.int 180 "Time to wait for yubikey in seconds";
|
||||||
mask = ''\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'';
|
};
|
||||||
openBinary = true;
|
|
||||||
interpreter = "${lib.getExe pkgs.box64}";
|
config = mkIf cfg.enable {
|
||||||
preserveArgvZero = true;
|
boot = {
|
||||||
matchCredentials = true;
|
kernelParams = [
|
||||||
fixBinary = false;
|
"quiet"
|
||||||
|
];
|
||||||
|
|
||||||
|
binfmt = lib.mkIf isArm {
|
||||||
|
registrations."x86_64-linux" = {
|
||||||
|
magicOrExtension = ''\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00'';
|
||||||
|
mask = ''\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'';
|
||||||
|
openBinary = true;
|
||||||
|
interpreter = "${lib.getExe pkgs.box64}";
|
||||||
|
preserveArgvZero = true;
|
||||||
|
matchCredentials = true;
|
||||||
|
fixBinary = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
supportedFilesystems = [ "bcachefs" ];
|
||||||
|
|
||||||
|
consoleLogLevel = lib.mkForce 3;
|
||||||
|
bootspec.enable = (!isArm);
|
||||||
|
|
||||||
|
initrd = {
|
||||||
|
luks = mkIf cfg.yubikeyEncryption {
|
||||||
|
devices = {
|
||||||
|
"${config.disko.devices.disk.main.content.partitions.root.name}" = {
|
||||||
|
yubikey = {
|
||||||
|
storage = {
|
||||||
|
device = "/dev/disk/by-label/${config.disko.devices.disk.main.content.partitions.root.name}";
|
||||||
|
fsType = config.${namespace}.hardware.disko.filesystem;
|
||||||
|
path = "/";
|
||||||
|
};
|
||||||
|
slot = 2;
|
||||||
|
twoFactor = false;
|
||||||
|
gracePeriod = yubikeyGracePeriod;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
supportedFilesystems = [ "bcachefs" ];
|
zramSwap.enable = lib.mkDefault true;
|
||||||
|
|
||||||
consoleLogLevel = lib.mkForce 3;
|
|
||||||
bootspec.enable = (!isArm);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
zramSwap.enable = lib.mkDefault true;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{ config, lib, namespace, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
inherit (lib.${namespace}) mkOpt;
|
inherit (lib.${namespace}) mkOpt;
|
||||||
@@ -26,4 +31,4 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{ lib, pkgs, namespace, ... }:
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
inherit (lib.${namespace}) mkOpt;
|
inherit (lib.${namespace}) mkOpt;
|
||||||
@@ -14,9 +19,9 @@ in
|
|||||||
enable = mkEnableOption "enable hyprland desktop environment";
|
enable = mkEnableOption "enable hyprland desktop environment";
|
||||||
|
|
||||||
wallpaperSource = mkOpt (types.enum [
|
wallpaperSource = mkOpt (types.enum [
|
||||||
"bing"
|
"bing"
|
||||||
"nasa"
|
"nasa"
|
||||||
]) "bing" "Source for the wallpaper (bing or nasa)";
|
]) "bing" "Source for the wallpaper (bing or nasa)";
|
||||||
|
|
||||||
wallpaper = mkOpt types.path "/var/lib/wallpapers/current.jpg" "Path to the wallpaper folder";
|
wallpaper = mkOpt types.path "/var/lib/wallpapers/current.jpg" "Path to the wallpaper folder";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
{ config, lib, pkgs, namespace, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.${namespace}.desktop.hyprland;
|
cfg = config.${namespace}.desktop.hyprland;
|
||||||
|
|
||||||
@@ -173,4 +179,4 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ let
|
|||||||
|
|
||||||
# BCacheFS root partition configuration
|
# BCacheFS root partition configuration
|
||||||
bcachefsRoot = {
|
bcachefsRoot = {
|
||||||
|
name = "bcachefs-root";
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "bcachefs";
|
type = "bcachefs";
|
||||||
|
|||||||
@@ -23,20 +23,18 @@ in
|
|||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
# Common Raspberry Pi packages
|
# Common Raspberry Pi packages
|
||||||
environment.systemPackages =
|
environment.systemPackages = with pkgs; [
|
||||||
with pkgs;
|
i2c-tools
|
||||||
[
|
libraspberrypi
|
||||||
i2c-tools
|
raspberrypi-eeprom
|
||||||
libraspberrypi
|
raspberrypifw
|
||||||
raspberrypi-eeprom
|
raspberrypiWirelessFirmware
|
||||||
raspberrypifw
|
raspberrypi-armstubs
|
||||||
raspberrypiWirelessFirmware
|
erofs-utils
|
||||||
raspberrypi-armstubs
|
fex
|
||||||
erofs-utils
|
squashfuse
|
||||||
fex
|
squashfsTools
|
||||||
squashfuse
|
];
|
||||||
squashfsTools
|
|
||||||
];
|
|
||||||
|
|
||||||
# Common Bluetooth configuration
|
# Common Bluetooth configuration
|
||||||
systemd.services.btattach = {
|
systemd.services.btattach = {
|
||||||
|
|||||||
@@ -19,29 +19,33 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
# extraDirectories = mkOpt (types.listOf types.path) [ ] "Extra directory paths to add to impermanence";
|
# extraDirectories = mkOpt (types.listOf types.path) [ ] "Extra directory paths to add to impermanence";
|
||||||
extraDirectories = mkOpt (types.listOf (types.either types.str (types.submodule {
|
extraDirectories = mkOpt (types.listOf (
|
||||||
options = {
|
types.either types.str (
|
||||||
directory = mkOption {
|
types.submodule {
|
||||||
type = types.str;
|
options = {
|
||||||
description = "Directory path";
|
directory = mkOption {
|
||||||
};
|
type = types.str;
|
||||||
user = mkOption {
|
description = "Directory path";
|
||||||
type = types.str;
|
};
|
||||||
default = "root";
|
user = mkOption {
|
||||||
description = "Directory owner";
|
type = types.str;
|
||||||
};
|
default = "root";
|
||||||
group = mkOption {
|
description = "Directory owner";
|
||||||
type = types.str;
|
};
|
||||||
default = "root";
|
group = mkOption {
|
||||||
description = "Directory group";
|
type = types.str;
|
||||||
};
|
default = "root";
|
||||||
mode = mkOption {
|
description = "Directory group";
|
||||||
type = types.str;
|
};
|
||||||
default = "u=rwx,g=rx,o=";
|
mode = mkOption {
|
||||||
description = "Directory permissions";
|
type = types.str;
|
||||||
};
|
default = "u=rwx,g=rx,o=";
|
||||||
};
|
description = "Directory permissions";
|
||||||
}))) [ ] "Extra directory paths to add to impermanence";
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)) [ ] "Extra directory paths to add to impermanence";
|
||||||
extraFiles = mkOpt (types.listOf types.path) [ ] "Extra file paths to add to impermanence";
|
extraFiles = mkOpt (types.listOf types.path) [ ] "Extra file paths to add to impermanence";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -79,10 +83,12 @@ in
|
|||||||
group = "jallen-nas";
|
group = "jallen-nas";
|
||||||
mode = "u=rwx,g=rx,o=rx";
|
mode = "u=rwx,g=rx,o=rx";
|
||||||
}
|
}
|
||||||
] ++ cfg.extraDirectories;
|
]
|
||||||
|
++ cfg.extraDirectories;
|
||||||
files = [
|
files = [
|
||||||
"/etc/machine-id"
|
"/etc/machine-id"
|
||||||
] ++ cfg.extraFiles;
|
]
|
||||||
|
++ cfg.extraFiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
security.sudo.extraConfig = ''
|
security.sudo.extraConfig = ''
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ with lib;
|
|||||||
let
|
let
|
||||||
cfg = config.${namespace}.network;
|
cfg = config.${namespace}.network;
|
||||||
|
|
||||||
profiles =
|
profiles =
|
||||||
let
|
let
|
||||||
make =
|
make =
|
||||||
name: profile:
|
name: profile:
|
||||||
@@ -21,16 +21,19 @@ let
|
|||||||
autoconnect-priority = profile.priority;
|
autoconnect-priority = profile.priority;
|
||||||
interface-name = cfg.ipv4.interface;
|
interface-name = cfg.ipv4.interface;
|
||||||
};
|
};
|
||||||
ipv4 =
|
ipv4 = {
|
||||||
{
|
method = cfg.ipv4.method;
|
||||||
method = cfg.ipv4.method;
|
}
|
||||||
} // (if (cfg.ipv4.method == "auto") then { }
|
// (
|
||||||
else
|
if (cfg.ipv4.method == "auto") then
|
||||||
{
|
{ }
|
||||||
address = cfg.ipv4.address;
|
else
|
||||||
gateway = cfg.ipv4.gateway;
|
{
|
||||||
dns = cfg.ipv4.dns;
|
address = cfg.ipv4.address;
|
||||||
});
|
gateway = cfg.ipv4.gateway;
|
||||||
|
dns = cfg.ipv4.dns;
|
||||||
|
}
|
||||||
|
);
|
||||||
ipv6 = {
|
ipv6 = {
|
||||||
addr-gen-mode = "stable-privacy";
|
addr-gen-mode = "stable-privacy";
|
||||||
method = "auto";
|
method = "auto";
|
||||||
|
|||||||
@@ -53,30 +53,40 @@ in
|
|||||||
|
|
||||||
powersave = mkBoolOpt false "Whether to enable WiFi power saving.";
|
powersave = mkBoolOpt false "Whether to enable WiFi power saving.";
|
||||||
|
|
||||||
profiles = mkOpt (types.attrsOf (
|
profiles =
|
||||||
types.submodule {
|
mkOpt
|
||||||
options = {
|
(types.attrsOf (
|
||||||
ssid = mkOpt types.str "" "SSID of the WiFi network.";
|
types.submodule {
|
||||||
|
options = {
|
||||||
|
ssid = mkOpt types.str "" "SSID of the WiFi network.";
|
||||||
|
|
||||||
type = mkOpt types.str "wifi" "type of the network.(wifi/ethernet)";
|
type = mkOpt types.str "wifi" "type of the network.(wifi/ethernet)";
|
||||||
|
|
||||||
autoconnect = mkBoolOpt true "autoconnect to this connection";
|
autoconnect = mkBoolOpt true "autoconnect to this connection";
|
||||||
|
|
||||||
autoconnect-retries = mkOpt types.int (-1) "The number of times a connection should be tried when autoactivating before giving up. Zero means forever, -1 means the global default (4 times if not overridden)";
|
autoconnect-retries =
|
||||||
|
mkOpt types.int (-1)
|
||||||
|
"The number of times a connection should be tried when autoactivating before giving up. Zero means forever, -1 means the global default (4 times if not overridden)";
|
||||||
|
|
||||||
priority = mkOpt types.int 0 "connection priority in range -999 to 999. The higher number means higher priority.";
|
priority =
|
||||||
|
mkOpt types.int 0
|
||||||
|
"connection priority in range -999 to 999. The higher number means higher priority.";
|
||||||
|
|
||||||
psk = mkOpt types.str "$PSK" "PSK environment variable for the WiFi password.";
|
psk = mkOpt types.str "$PSK" "PSK environment variable for the WiFi password.";
|
||||||
|
|
||||||
keyMgmt = mkOpt types.str "sae" "Key management type (e.g., sae, wpa-psk).";
|
keyMgmt = mkOpt types.str "sae" "Key management type (e.g., sae, wpa-psk).";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
))
|
||||||
|
{
|
||||||
|
"Joey's Jungle 6G" = {
|
||||||
|
priority = -900;
|
||||||
|
};
|
||||||
|
"Joey's Jungle 5G" = {
|
||||||
|
priority = -999;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
))
|
"network profiles.";
|
||||||
{
|
|
||||||
"Joey's Jungle 6G" = { priority = -900; };
|
|
||||||
"Joey's Jungle 5G" = { priority = -999; };
|
|
||||||
}
|
|
||||||
"network profiles.";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
hostId = mkOpt types.str "" "Host ID for ZFS and other services.";
|
hostId = mkOpt types.str "" "Host ID for ZFS and other services.";
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{ config, lib, namespace, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
inherit (lib.${namespace}) mkOpt;
|
inherit (lib.${namespace}) mkOpt;
|
||||||
@@ -60,4 +65,4 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{ config, lib, namespace, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
# inherit (lib.${namespace}) mkOpt;
|
# inherit (lib.${namespace}) mkOpt;
|
||||||
@@ -30,4 +35,4 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ in
|
|||||||
soft_auto_provision = false;
|
soft_auto_provision = false;
|
||||||
allow_multiple_user_backends = false; # auto redirect to authentik for login
|
allow_multiple_user_backends = false; # auto redirect to authentik for login
|
||||||
};
|
};
|
||||||
|
|
||||||
social_login_auto_redirect = true;
|
social_login_auto_redirect = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{ lib, config, namespace, ... }:
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.${namespace}.samba;
|
cfg = config.${namespace}.samba;
|
||||||
|
|||||||
@@ -28,7 +28,10 @@ with lib;
|
|||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
default = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||||
description = "List of SSH key paths to use for age decryption.";
|
description = "List of SSH key paths to use for age decryption.";
|
||||||
example = [ "/etc/ssh/ssh_host_ed25519_key" "/etc/ssh/ssh_host_rsa_key" ];
|
example = [
|
||||||
|
"/etc/ssh/ssh_host_ed25519_key"
|
||||||
|
"/etc/ssh/ssh_host_rsa_key"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
validateSopsFiles = mkOption {
|
validateSopsFiles = mkOption {
|
||||||
|
|||||||
@@ -248,4 +248,4 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,6 @@
|
|||||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||||
|
|
||||||
{ pkgs, namespace, ... }:
|
{ pkgs, namespace, ... }:
|
||||||
let
|
|
||||||
# Displays
|
|
||||||
display = {
|
|
||||||
input = "eDP-1";
|
|
||||||
resolution = "3456x2234";
|
|
||||||
refreshRate = "60.00000";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./boot.nix
|
./boot.nix
|
||||||
@@ -46,39 +38,47 @@ in
|
|||||||
distrobox
|
distrobox
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
programs = {
|
|
||||||
|
desktop = {
|
||||||
hyprland = {
|
hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
primaryDisplay = "eDP-1";
|
wallpaperSource = "nasa";
|
||||||
|
|
||||||
display1 = {
|
|
||||||
input = "eDP-1";
|
|
||||||
resolution = "3456x2234";
|
|
||||||
refreshRate = "60.00000";
|
|
||||||
};
|
|
||||||
|
|
||||||
wallpaper = [
|
|
||||||
"${display.input}, /run/wallpaper.jpg"
|
|
||||||
];
|
|
||||||
|
|
||||||
monitor = [
|
|
||||||
"${display.input},${display.resolution}@${display.refreshRate},0x0,1.25,bitdepth,10,cm,hdr,sdrbrightness,1.2,sdrsaturation,0.98"
|
|
||||||
];
|
|
||||||
|
|
||||||
workspace = [
|
|
||||||
"name:firefox, monitor:${display.input}, default:false, special, class:(.*firefox.*)"
|
|
||||||
"name:discord, monitor:${display.input}, default:true, special, title:(.*vesktop.*), title:(.*Apple Music.*)"
|
|
||||||
"name:steam, monitor:${display.input}, default:false, special, class:(.*[Ss]team.*)"
|
|
||||||
];
|
|
||||||
|
|
||||||
windowRule = [
|
|
||||||
"size 2160 3356, tag:horizonrdp"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
gnome.enable = false;
|
||||||
};
|
};
|
||||||
|
# programs = {
|
||||||
|
# hyprland = {
|
||||||
|
# enable = true;
|
||||||
|
# primaryDisplay = "eDP-1";
|
||||||
|
|
||||||
|
# display1 = {
|
||||||
|
# input = "eDP-1";
|
||||||
|
# resolution = "3456x2234";
|
||||||
|
# refreshRate = "60.00000";
|
||||||
|
# };
|
||||||
|
|
||||||
|
# wallpaper = [
|
||||||
|
# "${display.input}, /run/wallpaper.jpg"
|
||||||
|
# ];
|
||||||
|
|
||||||
|
# monitor = [
|
||||||
|
# "${display.input},${display.resolution}@${display.refreshRate},0x0,1.25,bitdepth,10,cm,hdr,sdrbrightness,1.2,sdrsaturation,0.98"
|
||||||
|
# ];
|
||||||
|
|
||||||
|
# workspace = [
|
||||||
|
# "name:firefox, monitor:${display.input}, default:false, special, class:(.*firefox.*)"
|
||||||
|
# "name:discord, monitor:${display.input}, default:true, special, title:(.*vesktop.*), title:(.*Apple Music.*)"
|
||||||
|
# "name:steam, monitor:${display.input}, default:false, special, class:(.*[Ss]team.*)"
|
||||||
|
# ];
|
||||||
|
|
||||||
|
# windowRule = [
|
||||||
|
# "size 2160 3356, tag:horizonrdp"
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
# };
|
||||||
network = {
|
network = {
|
||||||
hostName = "macbook-pro-nixos";
|
hostName = "macbook-pro-nixos";
|
||||||
wifi.enable = false;
|
networkmanager.enable = false;
|
||||||
iwd = {
|
iwd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
@@ -106,8 +106,9 @@ in
|
|||||||
nixpkgs.config.allowUnsupportedSystem = true;
|
nixpkgs.config.allowUnsupportedSystem = true;
|
||||||
|
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
containers.enable = true;
|
waydroid.enable = false;
|
||||||
podman.enable = true;
|
# - CONFIG_ANDROID_BINDER_IPC is not enabled!
|
||||||
|
# - CONFIG_ANDROID_BINDERFS is not enabled
|
||||||
};
|
};
|
||||||
|
|
||||||
# List packages installed in system profile. To search, run:
|
# List packages installed in system profile. To search, run:
|
||||||
|
|||||||
@@ -65,10 +65,14 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
logind = {
|
logind = {
|
||||||
lidSwitch = "suspend";
|
settings = {
|
||||||
lidSwitchExternalPower = "ignore";
|
Login = {
|
||||||
powerKey = "suspend";
|
HandleLidSwitchExternalPower = "ignore";
|
||||||
powerKeyLongPress = "poweroff";
|
HandleLidSwitch = "suspend";
|
||||||
|
HandlePowerKeyLongPress = "poweroff";
|
||||||
|
HandlePowerKey = "suspend";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable Flatpak
|
# Enable Flatpak
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
allowedTCPPorts = [ 53 ];
|
allowedTCPPorts = [ 53 ];
|
||||||
allowedUDPPorts = [ 53 ];
|
allowedUDPPorts = [ 53 ];
|
||||||
};
|
};
|
||||||
networkmanger = {
|
networkmanager = {
|
||||||
profiles = {
|
profiles = {
|
||||||
"static-enabcm6e4ei0" = {
|
"static-enabcm6e4ei0" = {
|
||||||
type = "ethernet";
|
type = "ethernet";
|
||||||
|
|||||||
@@ -160,7 +160,7 @@
|
|||||||
# ###################################################
|
# ###################################################
|
||||||
# # Samba # #
|
# # Samba # #
|
||||||
# ###################################################
|
# ###################################################
|
||||||
|
|
||||||
samba = {
|
samba = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hostsAllow = "10.0.1.";
|
hostsAllow = "10.0.1.";
|
||||||
|
|||||||
@@ -29,16 +29,6 @@
|
|||||||
};
|
};
|
||||||
network = {
|
network = {
|
||||||
hostName = "steamdeck";
|
hostName = "steamdeck";
|
||||||
wifi = {
|
|
||||||
enable = true;
|
|
||||||
powersave = false;
|
|
||||||
profiles = {
|
|
||||||
"Joey's Jungle 5G" = {
|
|
||||||
ssid = "Joey's Jungle 5G";
|
|
||||||
keyMgmt = "sae";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user