fix: Flake | use nixfmt=classic to format nix files
This commit is contained in:
@@ -72,7 +72,7 @@ lspconfig.nil_ls.setup {
|
|||||||
['nil'] = {
|
['nil'] = {
|
||||||
testSetting = 42,
|
testSetting = 42,
|
||||||
formatting = {
|
formatting = {
|
||||||
command = { "alejandra" },
|
command = { "nixfmt" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
48
flake.nix
48
flake.nix
@@ -40,33 +40,33 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {nixpkgs, ...} @ inputs: let
|
outputs = { nixpkgs, ... }@inputs:
|
||||||
inherit (nixpkgs) lib;
|
let
|
||||||
mkHost = host: {
|
inherit (nixpkgs) lib;
|
||||||
${host} = nixpkgs.lib.nixosSystem {
|
mkHost = host: {
|
||||||
specialArgs = {
|
${host} = nixpkgs.lib.nixosSystem {
|
||||||
inherit inputs;
|
specialArgs = {
|
||||||
|
inherit inputs;
|
||||||
|
|
||||||
# Extend lib with lib.custom
|
# Extend lib with lib.custom
|
||||||
lib = nixpkgs.lib.extend (self: super: { custom = import ./lib { inherit (nixpkgs) lib; }; });
|
lib = nixpkgs.lib.extend (self: super: {
|
||||||
|
custom = import ./lib { inherit (nixpkgs) lib; };
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
modules = [ ./hosts/nixos/${host} ];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
mkHostConfigs = hosts:
|
||||||
|
lib.foldl (acc: set: acc // set) { }
|
||||||
|
(lib.map (host: mkHost host) hosts);
|
||||||
|
readHosts = folder: lib.attrNames (builtins.readDir ./hosts/${folder});
|
||||||
|
in {
|
||||||
|
nixosConfigurations = mkHostConfigs (readHosts "nixos");
|
||||||
|
|
||||||
modules = [ ./hosts/nixos/${host} ];
|
devShell.x86_64-linux = let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
|
in pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [ nil nixfmt-classic lua-language-server ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
mkHostConfigs = hosts: lib.foldl (acc: set: acc // set) { } (lib.map (host: mkHost host) hosts);
|
|
||||||
readHosts = folder: lib.attrNames (builtins.readDir ./hosts/${folder});
|
|
||||||
in {
|
|
||||||
nixosConfigurations = mkHostConfigs (readHosts "nixos");
|
|
||||||
|
|
||||||
devShell.x86_64-linux = let
|
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
|
||||||
in pkgs.mkShell {
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
nil
|
|
||||||
alejandra
|
|
||||||
lua-language-server
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{
|
{ config, ... }:
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.alacritty = {
|
programs.alacritty = {
|
||||||
@@ -21,9 +18,7 @@
|
|||||||
decorations_theme_variant = "None";
|
decorations_theme_variant = "None";
|
||||||
};
|
};
|
||||||
|
|
||||||
env = {
|
env = { TERM = "xterm-256color"; };
|
||||||
TERM = "xterm-256color";
|
|
||||||
};
|
|
||||||
|
|
||||||
terminal.shell.program = "zsh";
|
terminal.shell.program = "zsh";
|
||||||
|
|
||||||
@@ -34,9 +29,7 @@
|
|||||||
italic.family = config.hostSpec.font;
|
italic.family = config.hostSpec.font;
|
||||||
};
|
};
|
||||||
|
|
||||||
cursor = {
|
cursor = { style = "Block"; };
|
||||||
style = "Block";
|
|
||||||
};
|
|
||||||
|
|
||||||
general.live_config_reload = true;
|
general.live_config_reload = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,16 +1,6 @@
|
|||||||
{
|
{ config, lib, pkgs, hostSpec, ... }: {
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
hostSpec,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
imports = lib.flatten [
|
imports = lib.flatten [
|
||||||
(map lib.custom.relativeToRoot [
|
(map lib.custom.relativeToRoot [ "modules/common" "modules/home-manager" ])
|
||||||
"modules/common"
|
|
||||||
"modules/home-manager"
|
|
||||||
])
|
|
||||||
|
|
||||||
./alacritty.nix
|
./alacritty.nix
|
||||||
./direnv.nix
|
./direnv.nix
|
||||||
@@ -24,9 +14,7 @@
|
|||||||
username = lib.mkDefault config.hostSpec.username;
|
username = lib.mkDefault config.hostSpec.username;
|
||||||
homeDirectory = lib.mkDefault config.hostSpec.home;
|
homeDirectory = lib.mkDefault config.hostSpec.home;
|
||||||
stateVersion = lib.mkDefault "25.05";
|
stateVersion = lib.mkDefault "25.05";
|
||||||
sessionPath = [
|
sessionPath = [ "$HOME/.local/bin" ];
|
||||||
"$HOME/.local/bin"
|
|
||||||
];
|
|
||||||
sessionVariables = {
|
sessionVariables = {
|
||||||
FLAKE = "$HOME/src/nix/nix-config";
|
FLAKE = "$HOME/src/nix/nix-config";
|
||||||
SHELL = "zsh";
|
SHELL = "zsh";
|
||||||
@@ -37,7 +25,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
file = {
|
file = {
|
||||||
"${config.xdg.configHome}/nvim".source = lib.custom.relativeToRoot "dotfiles/nvim";
|
"${config.xdg.configHome}/nvim".source =
|
||||||
|
lib.custom.relativeToRoot "dotfiles/nvim";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,10 +70,7 @@
|
|||||||
nix = {
|
nix = {
|
||||||
package = lib.mkDefault pkgs.nix;
|
package = lib.mkDefault pkgs.nix;
|
||||||
settings = {
|
settings = {
|
||||||
experimental-features = [
|
experimental-features = [ "nix-command" "flakes" ];
|
||||||
"nix-command"
|
|
||||||
"flakes"
|
|
||||||
];
|
|
||||||
warn-dirty = false;
|
warn-dirty = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, ... }: {
|
||||||
{
|
|
||||||
fonts.fontconfig.enable = true;
|
fonts.fontconfig.enable = true;
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [ nerd-fonts.jetbrains-mono ];
|
||||||
nerd-fonts.jetbrains-mono
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
{
|
{ lib, pkgs, config, ... }: {
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
programs.git = {
|
programs.git = {
|
||||||
package = pkgs.gitAndTools.gitFull;
|
package = pkgs.gitAndTools.gitFull;
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -11,24 +6,14 @@
|
|||||||
userEmail = config.hostSpec.email.user;
|
userEmail = config.hostSpec.email.user;
|
||||||
|
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
gpg = {
|
gpg = { format = "ssh"; };
|
||||||
format = "ssh";
|
|
||||||
};
|
|
||||||
"gpg \"ssh\"" = {
|
"gpg \"ssh\"" = {
|
||||||
program = "${lib.getExe' pkgs._1password-gui "op-ssh-sign"}";
|
program = "${lib.getExe' pkgs._1password-gui "op-ssh-sign"}";
|
||||||
};
|
};
|
||||||
commit = {
|
commit = { gpgsign = true; };
|
||||||
gpgsign = true;
|
user = { signingKey = "~/.ssh/id_rihla.pub"; };
|
||||||
};
|
pull = { rebase = true; };
|
||||||
user = {
|
init = { defaultBranch = "main"; };
|
||||||
signingKey = "~/.ssh/id_rihla.pub";
|
|
||||||
};
|
|
||||||
pull = {
|
|
||||||
rebase = true;
|
|
||||||
};
|
|
||||||
init = {
|
|
||||||
defaultBranch = "main";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
{ ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.btop = {
|
programs.btop = { enable = true; };
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{pkgs, ...}: {
|
{ pkgs, ... }: {
|
||||||
programs.firefox = {
|
programs.firefox = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.firefox.override {
|
package = pkgs.firefox.override {
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
{
|
{ config, lib, pkgs, ... }:
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
home = {
|
home = {
|
||||||
file = {
|
file = {
|
||||||
"${config.xdg.configHome}/hypr".source = lib.custom.relativeToRoot "dotfiles/hypr";
|
"${config.xdg.configHome}/hypr".source =
|
||||||
"${config.xdg.configHome}/waybar".source = lib.custom.relativeToRoot "dotfiles/waybar";
|
lib.custom.relativeToRoot "dotfiles/hypr";
|
||||||
"${config.xdg.configHome}/wofi".source = lib.custom.relativeToRoot "dotfiles/wofi";
|
"${config.xdg.configHome}/waybar".source =
|
||||||
"${config.xdg.configHome}/mako".source = lib.custom.relativeToRoot "dotfiles/mako";
|
lib.custom.relativeToRoot "dotfiles/waybar";
|
||||||
|
"${config.xdg.configHome}/wofi".source =
|
||||||
|
lib.custom.relativeToRoot "dotfiles/wofi";
|
||||||
|
"${config.xdg.configHome}/mako".source =
|
||||||
|
lib.custom.relativeToRoot "dotfiles/mako";
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{
|
{ pkgs, ... }:
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
{
|
{ ... }:
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.neovim = {
|
programs.neovim = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{...}: let
|
{ ... }:
|
||||||
onePassPath = "~/.1password/agent.sock";
|
let onePassPath = "~/.1password/agent.sock";
|
||||||
in {
|
in {
|
||||||
programs.ssh = {
|
programs.ssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
@@ -1,3 +1 @@
|
|||||||
{...}: {
|
{ ... }: { programs.starship.enable = true; }
|
||||||
programs.starship.enable = true;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
{
|
{ config, lib, pkgs, ... }:
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
home = {
|
home = {
|
||||||
file = {
|
file = {
|
||||||
"${config.xdg.configHome}/tmux".source = lib.custom.relativeToRoot "dotfiles/tmux";
|
"${config.xdg.configHome}/tmux".source =
|
||||||
|
lib.custom.relativeToRoot "dotfiles/tmux";
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [ tmux ];
|
||||||
tmux
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{config, ...}: {
|
{ config, ... }: {
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
{
|
{ lib, ... }: {
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
imports = lib.flatten [
|
imports = lib.flatten [
|
||||||
#
|
#
|
||||||
# ========== Required Configs ==========
|
# ========== Required Configs ==========
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
{
|
{ pkgs, inputs, config, lib, ... }:
|
||||||
pkgs,
|
|
||||||
inputs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = lib.flatten [
|
imports = lib.flatten [
|
||||||
@@ -20,9 +14,7 @@
|
|||||||
hostSpec = {
|
hostSpec = {
|
||||||
username = "shahab";
|
username = "shahab";
|
||||||
handle = "shahab96";
|
handle = "shahab96";
|
||||||
email = {
|
email = { user = "shahab@dogar.dev"; };
|
||||||
user = "shahab@dogar.dev";
|
|
||||||
};
|
|
||||||
userFullName = "Shahab Dogar";
|
userFullName = "Shahab Dogar";
|
||||||
domain = "rihla";
|
domain = "rihla";
|
||||||
networking.ports.tcp.ssh = 22;
|
networking.ports.tcp.ssh = 22;
|
||||||
@@ -60,12 +52,11 @@
|
|||||||
warn-dirty = false;
|
warn-dirty = false;
|
||||||
trusted-users = [ "@wheel" ];
|
trusted-users = [ "@wheel" ];
|
||||||
|
|
||||||
substituters = ["https://hyprland.cachix.org"];
|
substituters = [ "https://hyprland.cachix.org" ];
|
||||||
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
|
trusted-public-keys = [
|
||||||
experimental-features = [
|
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||||
"nix-command"
|
|
||||||
"flakes"
|
|
||||||
];
|
];
|
||||||
|
experimental-features = [ "nix-command" "flakes" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -79,9 +70,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# ========= Sops =========
|
# ========= Sops =========
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [ sops ];
|
||||||
sops
|
|
||||||
];
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# ========== Localization ==========
|
# ========== Localization ==========
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
{
|
{ lib, config, device, withSwap, swapSize, label, ... }:
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
device,
|
|
||||||
withSwap,
|
|
||||||
swapSize,
|
|
||||||
label,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
disko = {
|
disko = {
|
||||||
@@ -42,10 +34,8 @@
|
|||||||
passwordFile = "/tmp/secret.key";
|
passwordFile = "/tmp/secret.key";
|
||||||
settings = {
|
settings = {
|
||||||
allowDiscards = true;
|
allowDiscards = true;
|
||||||
crypttabExtraOpts = [
|
crypttabExtraOpts =
|
||||||
"fido2-device=auto"
|
[ "fido2-device=auto" "token-timeout=10" ];
|
||||||
"token-timeout=10"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
content = {
|
content = {
|
||||||
type = "lvm_pv";
|
type = "lvm_pv";
|
||||||
@@ -72,35 +62,20 @@
|
|||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "btrfs";
|
type = "btrfs";
|
||||||
extraArgs = [
|
extraArgs = [ "-L" label "-f" ];
|
||||||
"-L"
|
|
||||||
label
|
|
||||||
"-f"
|
|
||||||
];
|
|
||||||
subvolumes = {
|
subvolumes = {
|
||||||
"@root" = {
|
"@root" = {
|
||||||
mountpoint = "/";
|
mountpoint = "/";
|
||||||
mountOptions = [
|
mountOptions = [ "subvol=root" "compress=zstd" "noatime" ];
|
||||||
"subvol=root"
|
|
||||||
"compress=zstd"
|
|
||||||
"noatime"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
"@persist" = {
|
"@persist" = {
|
||||||
mountpoint = config.hostSpec.persist;
|
mountpoint = config.hostSpec.persist;
|
||||||
mountOptions = [
|
mountOptions =
|
||||||
"subvol=persist"
|
[ "subvol=persist" "compress=zstd" "noatime" ];
|
||||||
"compress=zstd"
|
|
||||||
"noatime"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
"@nix" = {
|
"@nix" = {
|
||||||
mountpoint = "/nix";
|
mountpoint = "/nix";
|
||||||
mountOptions = [
|
mountOptions = [ "subvol=nix" "compress=zstd" "noatime" ];
|
||||||
"subvol=nix"
|
|
||||||
"compress=zstd"
|
|
||||||
"noatime"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{
|
{ config, ... }:
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
programs = {
|
programs = {
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
{
|
{ ... }:
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.dconf.enable = true;
|
programs.dconf.enable = true;
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{
|
{ pkgs, ... }: {
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
podman = {
|
podman = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -14,11 +11,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
containers = {
|
containers = { registries = { search = [ "docker.io" ]; }; };
|
||||||
registries = {
|
|
||||||
search = ["docker.io"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
libvirtd = {
|
libvirtd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -27,7 +20,7 @@
|
|||||||
|
|
||||||
ovmf = {
|
ovmf = {
|
||||||
enable = true;
|
enable = true;
|
||||||
packages = with pkgs; [OVMFFull.fd];
|
packages = with pkgs; [ OVMFFull.fd ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{
|
{ pkgs, ... }:
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
programs = {
|
programs = {
|
||||||
@@ -15,8 +12,5 @@
|
|||||||
gamemode.enable = true;
|
gamemode.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [ mangohud protonup-qt ];
|
||||||
mangohud
|
|
||||||
protonup-qt
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
{
|
{ inputs, pkgs, ... }:
|
||||||
inputs,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.hyprland = {
|
programs.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
|
package =
|
||||||
|
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
|
||||||
portalPackage =
|
portalPackage =
|
||||||
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
|
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
{
|
{ ... }:
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.nix-ld.enable = true;
|
programs.nix-ld.enable = true;
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
{
|
{ pkgs, ... }:
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [ sbctl ];
|
||||||
sbctl
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{
|
{ pkgs, ... }:
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
services = {
|
services = {
|
||||||
@@ -17,7 +14,6 @@
|
|||||||
};
|
};
|
||||||
security.rtkit.enable = true;
|
security.rtkit.enable = true;
|
||||||
|
|
||||||
environment.systemPackages = builtins.attrValues {
|
environment.systemPackages =
|
||||||
inherit (pkgs) pavucontrol;
|
builtins.attrValues { inherit (pkgs) pavucontrol; };
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
{
|
{ ... }:
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
services.blueman.enable = true;
|
services.blueman.enable = true;
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
{
|
{ ... }:
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
services.fwupd.enable = true;
|
services.fwupd.enable = true;
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
{
|
{ pkgs, ... }:
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
services.greetd = {
|
services.greetd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
default_session = {
|
default_session = {
|
||||||
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --greeting 'Welcome to NixOS!' --asterisks --remember --remember-user-session --time --cmd ${pkgs.hyprland}/bin/Hyprland";
|
command =
|
||||||
|
"${pkgs.greetd.tuigreet}/bin/tuigreet --greeting 'Welcome to NixOS!' --asterisks --remember --remember-user-session --time --cmd ${pkgs.hyprland}/bin/Hyprland";
|
||||||
user = "greeter";
|
user = "greeter";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
{
|
{ config, ... }:
|
||||||
config,
|
let sshPort = config.hostSpec.networking.ports.tcp.ssh;
|
||||||
...
|
in {
|
||||||
}:
|
|
||||||
let
|
|
||||||
sshPort = config.hostSpec.networking.ports.tcp.ssh;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
ports = [ sshPort ];
|
ports = [ sshPort ];
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
# Reminder that CUPS cpanel defaults to localhost:631
|
# Reminder that CUPS cpanel defaults to localhost:631
|
||||||
{
|
{ ... }:
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
services.printing.enable = true;
|
services.printing.enable = true;
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
{
|
{ ... }:
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
services.pcscd.enable = true;
|
services.pcscd.enable = true;
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{
|
{ pkgs, ... }:
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
# yubikey login / sudo
|
# yubikey login / sudo
|
||||||
@@ -16,7 +13,5 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [ yubikey-manager ];
|
||||||
yubikey-manager
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
{
|
{ pkgs, config, lib, inputs, ... }:
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
let
|
||||||
hostSpec = config.hostSpec;
|
hostSpec = config.hostSpec;
|
||||||
pubKeys = lib.filesystem.listFilesRecursive ./keys;
|
pubKeys = lib.filesystem.listFilesRecursive ./keys;
|
||||||
@@ -19,20 +13,15 @@ in {
|
|||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
home = hostSpec.home;
|
home = hostSpec.home;
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
hashedPassword = "$y$j9T$pvjyL7hL5x2VBarGNTnMl1$mLA2UsWTbfp8Hgp/ug5l8224thi..Mo8.p7ME.tDZ.4";
|
hashedPassword =
|
||||||
extraGroups = [
|
"$y$j9T$pvjyL7hL5x2VBarGNTnMl1$mLA2UsWTbfp8Hgp/ug5l8224thi..Mo8.p7ME.tDZ.4";
|
||||||
"networkmanager"
|
extraGroups = [ "networkmanager" "wheel" "input" "libvirtd" ];
|
||||||
"wheel"
|
|
||||||
"input"
|
|
||||||
"libvirtd"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Read all keys in ./keys and add them to authorizedKeys.
|
# Read all keys in ./keys and add them to authorizedKeys.
|
||||||
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
|
openssh.authorizedKeys.keys =
|
||||||
|
lib.lists.forEach pubKeys (key: builtins.readFile key);
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [ libnotify ];
|
||||||
libnotify
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,12 +31,11 @@ in {
|
|||||||
hostSpec = config.hostSpec;
|
hostSpec = config.hostSpec;
|
||||||
};
|
};
|
||||||
users.${hostSpec.username}.imports = lib.flatten [
|
users.${hostSpec.username}.imports = lib.flatten [
|
||||||
(
|
({ config, ... }:
|
||||||
{ config, ... }:
|
import (lib.custom.relativeToRoot
|
||||||
import (lib.custom.relativeToRoot "home/${hostSpec.username}/${hostSpec.hostName}.nix") {
|
"home/${hostSpec.username}/${hostSpec.hostName}.nix") {
|
||||||
inherit pkgs inputs config lib hostSpec;
|
inherit pkgs inputs config lib hostSpec;
|
||||||
}
|
})
|
||||||
)
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
{
|
{ inputs, pkgs, lib, config, ... }:
|
||||||
inputs,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = lib.flatten [
|
imports = lib.flatten [
|
||||||
@@ -26,7 +20,8 @@
|
|||||||
# ========= Disk Layout =========
|
# ========= Disk Layout =========
|
||||||
#
|
#
|
||||||
inputs.disko.nixosModules.disko
|
inputs.disko.nixosModules.disko
|
||||||
(lib.custom.relativeToRoot "hosts/common/disks/rihla.nix") {
|
(lib.custom.relativeToRoot "hosts/common/disks/rihla.nix")
|
||||||
|
{
|
||||||
_module.args = {
|
_module.args = {
|
||||||
device = "/dev/nvme0n1";
|
device = "/dev/nvme0n1";
|
||||||
withSwap = true;
|
withSwap = true;
|
||||||
@@ -38,9 +33,7 @@
|
|||||||
#
|
#
|
||||||
# ========= Required Configs =========
|
# ========= Required Configs =========
|
||||||
#
|
#
|
||||||
(map lib.custom.relativeToRoot [
|
(map lib.custom.relativeToRoot [ "hosts/common/core" ])
|
||||||
"hosts/common/core"
|
|
||||||
])
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# ========= Optional Configs =========
|
# ========= Optional Configs =========
|
||||||
@@ -59,15 +52,16 @@
|
|||||||
#
|
#
|
||||||
# ========= Optional Services =========
|
# ========= Optional Services =========
|
||||||
#
|
#
|
||||||
(map (s: lib.custom.relativeToRoot "hosts/common/optional/services/${s}.nix") [
|
(map
|
||||||
"audio"
|
(s: lib.custom.relativeToRoot "hosts/common/optional/services/${s}.nix") [
|
||||||
"bluetooth"
|
"audio"
|
||||||
"firmware"
|
"bluetooth"
|
||||||
"greetd"
|
"firmware"
|
||||||
"openssh"
|
"greetd"
|
||||||
"printing"
|
"openssh"
|
||||||
"smart-card"
|
"printing"
|
||||||
])
|
"smart-card"
|
||||||
|
])
|
||||||
];
|
];
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -91,30 +85,31 @@
|
|||||||
efi.canTouchEfiVariables = true;
|
efi.canTouchEfiVariables = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
initrd.postResumeCommands = lib.mkIf config.hostSpec.impermanance (lib.mkAfter ''
|
initrd.postResumeCommands = lib.mkIf config.hostSpec.impermanance
|
||||||
mkdir /btrfs_tmp
|
(lib.mkAfter ''
|
||||||
mount /dev/crypt_vg/root /btrfs_tmp
|
mkdir /btrfs_tmp
|
||||||
if [[ -e /btrfs_tmp/root ]]; then
|
mount /dev/crypt_vg/root /btrfs_tmp
|
||||||
mkdir -p /btrfs_tmp/old_roots
|
if [[ -e /btrfs_tmp/root ]]; then
|
||||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
mkdir -p /btrfs_tmp/old_roots
|
||||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||||
fi
|
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||||
|
fi
|
||||||
|
|
||||||
delete_subvolume_recursively() {
|
delete_subvolume_recursively() {
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||||
done
|
done
|
||||||
btrfs subvolume delete "$1"
|
btrfs subvolume delete "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||||
delete_subvolume_recursively "$i"
|
delete_subvolume_recursively "$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
btrfs subvolume create /btrfs_tmp/root
|
btrfs subvolume create /btrfs_tmp/root
|
||||||
umount /btrfs_tmp
|
umount /btrfs_tmp
|
||||||
'');
|
'');
|
||||||
|
|
||||||
lanzaboote = {
|
lanzaboote = {
|
||||||
enable = config.hostSpec.secureBoot;
|
enable = config.hostSpec.secureBoot;
|
||||||
@@ -124,9 +119,7 @@
|
|||||||
|
|
||||||
security.rtkit.enable = true;
|
security.rtkit.enable = true;
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [ pciutils ];
|
||||||
pciutils
|
|
||||||
];
|
|
||||||
|
|
||||||
system.stateVersion = "25.05";
|
system.stateVersion = "25.05";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{
|
{ pkgs, config, lib, modulesPath, ... }: {
|
||||||
pkgs,
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
|
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
initrd = {
|
initrd = {
|
||||||
@@ -21,11 +15,11 @@
|
|||||||
"usb_storage"
|
"usb_storage"
|
||||||
"sd_mod"
|
"sd_mod"
|
||||||
];
|
];
|
||||||
kernelModules = [];
|
kernelModules = [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
kernelModules = ["kvm-amd"];
|
kernelModules = [ "kvm-amd" ];
|
||||||
extraModulePackages = [];
|
extraModulePackages = [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
@@ -38,10 +32,11 @@
|
|||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
hardware = {
|
hardware = {
|
||||||
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
cpu.amd.updateMicrocode =
|
||||||
|
lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
graphics = {
|
graphics = {
|
||||||
enable = true;
|
enable = true;
|
||||||
extraPackages = with pkgs; [amdvlk];
|
extraPackages = with pkgs; [ amdvlk ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{
|
{ lib, ... }:
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
relativeToRoot = lib.path.append ../.;
|
relativeToRoot = lib.path.append ../.;
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
{
|
{ ... }:
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [ ./host-spec.nix ];
|
||||||
./host-spec.nix
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
# Specifications For Differentiating Hosts
|
# Specifications For Differentiating Hosts
|
||||||
{
|
{ config, lib, ... }: {
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
options.hostSpec = {
|
options.hostSpec = {
|
||||||
username = lib.mkOption {
|
username = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
@@ -68,7 +63,8 @@
|
|||||||
scaling = lib.mkOption {
|
scaling = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "1";
|
default = "1";
|
||||||
description = "Used to indicate what scaling to use. Floating point number";
|
description =
|
||||||
|
"Used to indicate what scaling to use. Floating point number";
|
||||||
};
|
};
|
||||||
font = lib.mkOption {
|
font = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
{
|
{ ... }:
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [ ./yubikey-touch-detector.nix ];
|
||||||
./yubikey-touch-detector.nix
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let cfg = config.services.yubikey-touch-detector;
|
||||||
cfg = config.services.yubikey-touch-detector;
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
options.services.yubikey-touch-detector = {
|
options.services.yubikey-touch-detector = {
|
||||||
enable = mkEnableOption "a tool to detect when your YubiKey is waiting for a touch";
|
enable = mkEnableOption
|
||||||
|
"a tool to detect when your YubiKey is waiting for a touch";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
@@ -18,7 +17,8 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.enable = mkEnableOption "starting the process only when the socket is used";
|
socket.enable =
|
||||||
|
mkEnableOption "starting the process only when the socket is used";
|
||||||
|
|
||||||
extraArgs = mkOption {
|
extraArgs = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
@@ -37,7 +37,8 @@ in
|
|||||||
# See https://github.com/maximbaz/yubikey-touch-detector/blob/c9fdff7163361d6323e2de0449026710cacbc08a/LICENSE
|
# See https://github.com/maximbaz/yubikey-touch-detector/blob/c9fdff7163361d6323e2de0449026710cacbc08a/LICENSE
|
||||||
# Author: Maxim Baz
|
# Author: Maxim Baz
|
||||||
systemd.user.sockets.yubikey-touch-detector = mkIf cfg.socket.enable {
|
systemd.user.sockets.yubikey-touch-detector = mkIf cfg.socket.enable {
|
||||||
Unit.Description = "Unix socket activation for YubiKey touch detector service";
|
Unit.Description =
|
||||||
|
"Unix socket activation for YubiKey touch detector service";
|
||||||
Socket = {
|
Socket = {
|
||||||
ListenFIFO = "%t/yubikey-touch-detector.sock";
|
ListenFIFO = "%t/yubikey-touch-detector.sock";
|
||||||
RemoveOnStop = true;
|
RemoveOnStop = true;
|
||||||
@@ -50,15 +51,19 @@ in
|
|||||||
systemd.user.services.yubikey-touch-detector = {
|
systemd.user.services.yubikey-touch-detector = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Detects when your YubiKey is waiting for a touch";
|
Description = "Detects when your YubiKey is waiting for a touch";
|
||||||
Requires = optionals cfg.socket.enable [ "yubikey-touch-detector.socket" ];
|
Requires =
|
||||||
|
optionals cfg.socket.enable [ "yubikey-touch-detector.socket" ];
|
||||||
};
|
};
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart = "${cfg.package}/bin/yubikey-touch-detector ${concatStringsSep " " cfg.extraArgs}";
|
ExecStart = "${cfg.package}/bin/yubikey-touch-detector ${
|
||||||
|
concatStringsSep " " cfg.extraArgs
|
||||||
|
}";
|
||||||
Environment = [ "PATH=${lib.makeBinPath [ pkgs.gnupg ]}" ];
|
Environment = [ "PATH=${lib.makeBinPath [ pkgs.gnupg ]}" ];
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "1sec";
|
RestartSec = "1sec";
|
||||||
};
|
};
|
||||||
Install.Also = optionals cfg.socket.enable [ "yubikey-touch-detector.socket" ];
|
Install.Also =
|
||||||
|
optionals cfg.socket.enable [ "yubikey-touch-detector.socket" ];
|
||||||
Install.WantedBy = [ "default.target" ];
|
Install.WantedBy = [ "default.target" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user