Compare commits

..

2 Commits

Author SHA1 Message Date
869d3957b5 Merge branch 'master' into home_manager 2025-08-24 22:26:12 -04:00
2eaffa8cfb WIP on home manager 2025-08-19 17:32:38 -04:00
14 changed files with 144 additions and 29 deletions

3
.gitmodules vendored
View File

@@ -1,3 +1,6 @@
[submodule "assets/compose"] [submodule "assets/compose"]
path = assets/compose path = assets/compose
url = ssh://git@code.lazyworkhorse.net:2222/gortium/compose.git url = ssh://git@code.lazyworkhorse.net:2222/gortium/compose.git
[submodule "assets/dotfiles"]
path = assets/dotfiles
url = ssh://git@code.lazyworkhorse.net:2222/gortium/dotfiles.git

21
flake.lock generated
View File

@@ -44,6 +44,26 @@
"type": "github" "type": "github"
} }
}, },
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1755625756,
"narHash": "sha256-t57ayMEdV9g1aCfHzoQjHj1Fh3LDeyblceADm2hsLHM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "dd026d86420781e84d0732f2fa28e1c051117b59",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1755615617, "lastModified": 1755615617,
@@ -63,6 +83,7 @@
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"home-manager": "home-manager_2",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
}, },

View File

@@ -8,10 +8,14 @@
inputs.darwin.follows = ""; inputs.darwin.follows = "";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
self.submodules = true; self.submodules = true;
}; };
outputs = { self, nixpkgs, agenix, ... }@inputs: outputs = { self, nixpkgs, agenix, home-manager, ... }@inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
keys = import ./lib/keys.nix; keys = import ./lib/keys.nix;
@@ -39,10 +43,11 @@
modules = [ modules = [
{ nixpkgs.overlays = overlays; } { nixpkgs.overlays = overlays; }
agenix.nixosModules.default agenix.nixosModules.default
home-manager.nixosModules.default
./hosts/lazyworkhorse/configuration.nix ./hosts/lazyworkhorse/configuration.nix
./hosts/lazyworkhorse/hardware-configuration.nix ./hosts/lazyworkhorse/hardware-configuration.nix
./modules/default.nix ./modules/default.nix
./users/gortium.nix ./users/gortium
]; ];
}; };
}; };

View File

@@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page, on # your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, paths, keys, ... }: { config, lib, pkgs, self, paths, keys, ... }:
{ {
# NAS Mounting # NAS Mounting
@@ -16,7 +16,7 @@
nix.gc = { nix.gc = {
automatic = true; automatic = true;
dates = "daily"; # You can also use "daily" or a cron-like spec dates = "daily"; # You can also use "daily" or a cron-like spec
options = "--delete-older-than 30d"; options = "--delete-older-than 7d"; # Keep only 7 days of unreferenced data
}; };
nix.settings = { nix.settings = {
@@ -153,6 +153,8 @@
}; };
}; };
fileSystems."/".neededForBoot = true;
# Public host ssh key (kept in sync with the private one) # Public host ssh key (kept in sync with the private one)
environment.etc."ssh/ssh_host_ed25519_key.pub".text = environment.etc."ssh/ssh_host_ed25519_key.pub".text =
"${keys.hosts.lazyworkhorse.main}"; "${keys.hosts.lazyworkhorse.main}";
@@ -162,19 +164,6 @@
services.zfs.autoSnapshot.enable = true; services.zfs.autoSnapshot.enable = true;
services.zfs.autoScrub.enable = true; services.zfs.autoScrub.enable = true;
# hardware.graphics = {
# enable = true;
# enable32Bit = true;
# extraPackages = with pkgs; [
# rocmPackages.clr
# rocmPackages.rocblas
# rocmPackages.rocrand
# rocmPackages.rocminfo
# rocmPackages.hipcc
# rocmPackages.hiprt
# ];
# };
# Open ports in the firewall. # Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ];

View File

@@ -9,7 +9,7 @@
hosts = { hosts = {
lazyworkhorse = { lazyworkhorse = {
main = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBmPv4JssvhHGIx85UwFxDSrL5anR4eXB/cd9V2i9wdW"; main = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINmXqD+bBveCYf4khmARA0uaCzkBOUIE077ZrInLNs1O";
github = ""; github = "";
gitea = ""; gitea = "";
bootstrap = "age1r796v2uldtspawyh863pks74sd2pwcan8j4e4pjzsvkmr3vjja9qpz5ste"; bootstrap = "age1r796v2uldtspawyh863pks74sd2pwcan8j4e4pjzsvkmr3vjja9qpz5ste";

View File

@@ -1,6 +1,6 @@
{ pkgs, lib, config, ... }: { {
imports = imports = [
[ ./dotfiles.nix
./systemd ./systemd
]; ];
} }

View File

@@ -0,0 +1,69 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.dotfiles;
stowDir = cfg.stowDir;
# Function to recursively find all files in a directory
findFiles = dir:
let
files = builtins.attrNames (builtins.readDir dir);
in
concatMap (name:
let
path = dir + "/${name}";
in
if (builtins.typeOf (builtins.readDir path) == "set")
then findFiles path
else [ path ]
) files;
# Get a list of all packages (directories) in the stow directory
stowPackages = builtins.attrNames (builtins.readDir stowDir);
# Create an attribute set where each attribute is a package name
# and the value is a list of files to be linked.
homeManagerLinks = listToAttrs (map (pkg:
let
pkgPath = stowDir + "/${pkg}";
files = findFiles pkgPath;
in
nameValuePair pkg (map (file: {
source = file;
target = removePrefix (pkgPath + "/") file;
}) files)
) stowPackages);
in
{
options.services.dotfiles = {
enable = mkEnableOption "Enable dotfiles management";
stowDir = mkOption {
type = types.path;
description = "The directory where your stow packages are located.";
};
user = mkOption {
type = types.str;
description = "The user to manage dotfiles for.";
};
};
config = mkIf cfg.enable {
home-manager.users.${cfg.user} = {
home.file =
let
allFiles = concatLists (attrValues homeManagerLinks);
in
listToAttrs (map (file:
nameValuePair file.target {
source = file.source;
}
) allFiles);
};
};
}

View File

@@ -1,9 +1,14 @@
{ config, pkgs, self, ... }: { config, pkgs, self, ... }:
let let
network_compose_dir = builtins.path { network_compose_dir = pkgs.stdenv.mkDerivation {
name = "network_compose_dir"; name = "network_compose_dir";
path = self + "/assets/compose/network"; src = self + "/assets/compose/network";
dontUnpack = true;
installPhase = ''
mkdir -p $out
cp -r $src/* $out/
'';
}; };
in in
{ {

View File

@@ -1,9 +1,14 @@
{ config, pkgs, self, ... }: { config, pkgs, self, ... }:
let let
passwordmanager_compose_dir = builtins.path { passwordmanager_compose_dir = pkgs.stdenv.mkDerivation {
name = "passwordmanager_compose_dir"; name = "passwordmanager_compose_dir";
path = self + "/assets/compose/passwordmanager"; src = self + "/assets/compose/passwordmanager";
dontUnpack = true;
installPhase = ''
mkdir -p $out
cp -r $src/* $out/
'';
}; };
in in
{ {

View File

@@ -1,9 +1,14 @@
{ config, pkgs, self, ... }: { config, pkgs, self, ... }:
let let
versioncontrol_compose_dir = builtins.path { versioncontrol_compose_dir = pkgs.stdenv.mkDerivation {
name = "versioncontrol_compose_dir"; name = "versioncontrol_compose_dir";
path = self + "/assets/compose/versioncontrol"; src = self + "/assets/compose/versioncontrol";
dontUnpack = true;
installPhase = ''
mkdir -p $out
cp -r $src/* $out/
'';
}; };
in in
{ {

Binary file not shown.

View File

@@ -1,4 +1,5 @@
{ pkgs, inputs, config, keys, ... }: { { pkgs, inputs, config, keys, ... }: {
home-manager.users.gortium = import ./home.nix;
users.users.gortium = { users.users.gortium = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" "docker" ]; # Enable sudo for the user. extraGroups = [ "wheel" "docker" ]; # Enable sudo for the user.

12
users/gortium/home.nix Normal file
View File

@@ -0,0 +1,12 @@
{ pkgs, ... }: {
services.dotfiles = {
enable = true;
stowDir = ../../../assets/dotfiles;
user = "gortium";
};
home.username = "gortium";
home.homeDirectory = "/home/gortium";
home.stateVersion = "23.11"; # Please change this to your version.
programs.home-manager.enable = true;
}