Release v2.2.0

This commit is contained in:
Hadi
2024-08-19 20:32:10 +02:00
parent caaa500232
commit e6f66110f0
22 changed files with 194 additions and 191 deletions

View File

@@ -1,110 +1,28 @@
{ pkgs, config, ... }: {
{ config, ... }: {
imports = [
./hardware-configuration.nix
../modules/fonts.nix
../modules/nvidia.nix
# ../modules/prime.nix
../modules/zsh.nix
../modules/tuigreet.nix
../modules/auto-upgrade.nix
../modules/timezone.nix
../modules/usb.nix
../modules/systemd-boot.nix
../modules/users.nix
../modules/audio.nix
../modules/bluetooth.nix
../modules/tailscale.nix
../modules/nix.nix
../modules/network-manager.nix
../modules/home-manager.nix
../modules/utils.nix
./hardware-configuration.nix
./variables.nix
];
networking.networkmanager.enable = true;
networking.hostName = config.var.hostname;
systemd.services.NetworkManager-wait-online.enable = false;
services = {
tailscale.enable = config.var.tailscale;
xserver = {
enable = true;
xkb.layout = config.var.keyboardLayout;
xkb.variant = "";
};
blueman.enable = true;
gnome.gnome-keyring.enable = true;
};
console.keyMap = config.var.keyboardLayout;
programs.zsh = {
enable = true;
loginShellInit = ''
dbus-update-activation-environment --systemd DISPLAY
'';
};
users.defaultUserShell = pkgs.zsh;
environment.variables = {
XDG_DATA_HOME = "$HOME/.local/share";
PASSWORD_STORE_DIR = "$HOME/.local/share/password-store";
EDITOR = "nvim";
};
nix = {
extraOptions = ''
warn-dirty = false
'';
settings = {
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
gc = {
automatic = config.var.autoGarbageCollector;
persistent = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
networkmanagerapplet
fd
bc
gcc
git-ignore
xdg-utils
wget
curl
];
# nixpkgs.config.permittedInsecurePackages =
# [ "electron-25.9.0" ]; # TODO: test to remove
system.autoUpgrade = {
enable = config.var.autoUpgrade;
dates = "04:00";
flake = "${config.var.configDirectory}";
flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ];
allowReboot = false;
};
# xdg.portal = { # TODO: test to remove
# enable = true;
# configPackages = with pkgs; [ xdg-desktop-portal-gtk ];
# };
services.libinput.enable = true;
programs.dconf.enable = true;
# Faster rebuilding
documentation = {
enable = true;
doc.enable = false;
man.enable = true;
dev.enable = false;
};
services.dbus.enable = true;
home-manager.users."${config.var.username}" = import ./home.nix;
# Don't touch this
system.stateVersion = "24.05";

View File

@@ -0,0 +1,9 @@
{ config, ... }: {
system.autoUpgrade = {
enable = config.var.autoUpgrade;
dates = "04:00";
flake = "${config.var.configDirectory}";
flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ];
allowReboot = false;
};
}

View File

@@ -4,4 +4,6 @@
enable = true;
powerOnBoot = true;
};
services.blueman.enable = true;
}

View File

@@ -0,0 +1,7 @@
{ inputs, ... }: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs; };
};
}

View File

@@ -0,0 +1,6 @@
{ pkgs, ... }: {
networking.networkmanager.enable = true;
systemd.services.NetworkManager-wait-online.enable = false;
environment.systemPackages = with pkgs; [ networkmanagerapplet ];
}

22
hosts/modules/nix.nix Normal file
View File

@@ -0,0 +1,22 @@
{ config, ... }: {
nixpkgs.config.allowUnfree = true;
nix = {
extraOptions = ''
warn-dirty = false
'';
settings = {
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
gc = {
automatic = config.var.autoGarbageCollector;
persistent = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
}

View File

@@ -0,0 +1 @@
{ config, ... }: { services.tailscale.enable = config.var.tailscale; }

View File

@@ -1,7 +1,10 @@
{ config, ... }: {
users.users.${config.var.username} = {
isNormalUser = true;
description = "${config.var.username} account";
extraGroups = [ "networkmanager" "wheel" ];
{ config, pkgs, ... }: {
users = {
defaultUserShell = pkgs.zsh;
users.${config.var.username} = {
isNormalUser = true;
description = "${config.var.username} account";
extraGroups = [ "networkmanager" "wheel" ];
};
};
}

42
hosts/modules/utils.nix Normal file
View File

@@ -0,0 +1,42 @@
{ pkgs, config, ... }: {
networking.hostName = config.var.hostname;
services = {
xserver = {
enable = true;
xkb.layout = config.var.keyboardLayout;
xkb.variant = "";
};
gnome.gnome-keyring.enable = true;
};
console.keyMap = config.var.keyboardLayout;
environment.variables = {
XDG_DATA_HOME = "$HOME/.local/share";
PASSWORD_STORE_DIR = "$HOME/.local/share/password-store";
EDITOR = "nvim";
};
services.libinput.enable = true;
programs.dconf.enable = true;
services.dbus.enable = true;
# Faster rebuilding
documentation = {
enable = true;
doc.enable = false;
man.enable = true;
dev.enable = false;
};
environment.systemPackages = with pkgs; [
fd
bc
gcc
git-ignore
xdg-utils
wget
curl
];
}

8
hosts/modules/zsh.nix Normal file
View File

@@ -0,0 +1,8 @@
{
programs.zsh = {
enable = true;
loginShellInit = ''
dbus-update-activation-environment --systemd DISPLAY
'';
};
}

View File

@@ -1,4 +1,19 @@
{ pkgs, ... }: {
{ pkgs, ... }:
let
bitcoin-price = pkgs.writeShellScriptBin "bitcoin-price" ''
[ ! -d "/home/hadi/btcprice" ] && ${pkgs.git}/bin/git clone git@github.com:anotherhadi/btcprice /home/hadi/btcprice
cd "/home/hadi/btcprice"
price=$(${pkgs.curl}/bin/curl eur.rate.sx/1BTC)
echo "# Bitcoin Price in EURO" >README.md
echo "" >>README.md
echo "1 Bitcoin = $price" >>README.md
echo "" >>README.md
echo "Date: $(date)" >>README.md
${pkgs.git}/bin/git add .
${pkgs.git}/bin/git commit -m "Update price (hadi)"
${pkgs.git}/bin/git push -u origin main
'';
in {
systemd.timers."bitcoin-git" = {
wantedBy = [ "timers.target" ];
timerConfig = {
@@ -10,17 +25,7 @@
systemd.services."bitcoin-git" = {
script = ''
[ ! -d "/home/hadi/btcprice" ] && ${pkgs.git}/bin/git clone git@github.com:anotherhadi/btcprice /home/hadi/btcprice
cd "/home/hadi/btcprice"
price=$(${pkgs.curl}/bin/curl eur.rate.sx/1BTC)
echo "# Bitcoin Price in EURO" >README.md
echo "" >>README.md
echo "1 Bitcoin = $price" >>README.md
echo "" >>README.md
echo "Date: $(date)" >>README.md
${pkgs.git}/bin/git add .
${pkgs.git}/bin/git commit -m "Update price (hadi)"
${pkgs.git}/bin/git push -u origin main
${bitcoin-price}
exit 0
'';
serviceConfig = {

View File

@@ -17,7 +17,6 @@
# haugene/transmission-openvpn
# '';
# };
# TODO: launch the container at boot
networking.firewall.allowedTCPPorts = [ 9091 ];
}

View File

@@ -2,7 +2,7 @@
sops = {
age.keyFile = "/home/hadi/.config/sops/age/keys.txt";
defaultSopsFile = ./server.yaml;
defaultSopsFile = ./secrets.yaml;
defaultSopsFormat = "yaml";
secrets = {
sshconfig = {
@@ -14,15 +14,15 @@
owner = "hadi";
};
nextcloud-adminpass = {
mode = "0444"; # FIXME
mode = "0444";
path = "/etc/nextcloud/adminpassFile";
};
cloudflare-apitoken = {
mode = "0444"; # FIXME
mode = "0444";
path = "/etc/cloudflare/apiToken";
};
tailscaled-authKey = {
mode = "0444"; # FIXME
mode = "0444";
path = "/etc/tailscale/authKey";
};
transmission-script = {