diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-06-04 14:38:25 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-06-04 18:04:18 +0530 |
commit | 654fa9e430be421df30ee79e7ea5f4e40b39dddc (patch) | |
tree | 37d9bc759e3e1b3323e76d85d706123f3b799d88 /os | |
parent | 84073038e22d3201ac0176a94527c040bb153e9e (diff) |
home, os: refactor
Diffstat (limited to 'os')
-rw-r--r-- | os/cez/configuration.nix | 40 | ||||
-rw-r--r-- | os/cez/modules/network.nix | 15 | ||||
-rw-r--r-- | os/cez/modules/wireguard.nix | 7 | ||||
-rw-r--r-- | os/cez/secrets.yaml | 5 | ||||
-rw-r--r-- | os/common/configuration.nix | 13 | ||||
-rw-r--r-- | os/common/modules/dev.nix | 29 | ||||
-rw-r--r-- | os/pc/configuration.nix | 27 | ||||
-rw-r--r-- | os/pc/modules/getty.nix (renamed from os/cez/modules/getty.nix) | 0 | ||||
-rw-r--r-- | os/pc/modules/network.nix | 10 | ||||
-rw-r--r-- | os/pc/modules/sshfs.nix (renamed from os/cez/modules/sshfs.nix) | 10 | ||||
-rw-r--r-- | os/pc/modules/wayland.nix (renamed from os/cez/modules/wayland.nix) | 13 | ||||
-rw-r--r-- | os/pc/secrets.yaml | 31 |
12 files changed, 90 insertions, 110 deletions
diff --git a/os/cez/configuration.nix b/os/cez/configuration.nix index f8c9dfe..655ff8b 100644 --- a/os/cez/configuration.nix +++ b/os/cez/configuration.nix @@ -1,42 +1,14 @@ -{ config, pkgs, ... }: let - user = config.global.userdata.name; -in { +{ ... }: { imports = [ - ../common/configuration.nix + ../pc/configuration.nix ./hardware-configuration.nix - ./modules/wayland.nix - ./modules/sshfs.nix ./modules/wireguard.nix - ./modules/network.nix ./modules/tlp.nix - ./modules/getty.nix ]; - boot = { - consoleLogLevel = 3; - kernelPackages = pkgs.linuxPackages_latest; - }; - - sound = { - enable = true; - extraConfig = '' - defaults.pcm.card 1 - defaults.ctl.card 1 - ''; - }; - - services.pipewire = { - enable = true; - pulse.enable = true; - }; - - programs.adb.enable = true; - users.users.${user} = { - extraGroups = [ "adbusers" ]; - packages = with pkgs; [ - ffmpeg - (pass.withExtensions (exts: [ exts.pass-otp ])) - ]; - }; + sound.extraConfig = '' + defaults.pcm.card 1 + defaults.ctl.card 1 + ''; } diff --git a/os/cez/modules/network.nix b/os/cez/modules/network.nix deleted file mode 100644 index fb30056..0000000 --- a/os/cez/modules/network.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ ... }: - -{ - networking = { - firewall.enable = false; - - wireless.iwd = { - enable = true; - settings = { - General.EnableNetworkConfiguration = true; - Network.NameResolvingService = "resolvconf"; - }; - }; - }; -} diff --git a/os/cez/modules/wireguard.nix b/os/cez/modules/wireguard.nix index 706751c..40dd796 100644 --- a/os/cez/modules/wireguard.nix +++ b/os/cez/modules/wireguard.nix @@ -1,9 +1,6 @@ -{ config, ... }: - -let +{ config, ... }: let domain = config.global.userdata.domain; -in -{ +in { sops.secrets."misc/wireguard" = {}; networking.wg-quick.interfaces."kay" = { diff --git a/os/cez/secrets.yaml b/os/cez/secrets.yaml index f72eba6..5cfd108 100644 --- a/os/cez/secrets.yaml +++ b/os/cez/secrets.yaml @@ -1,5 +1,4 @@ misc: - sftp: ENC[AES256_GCM,data:xic1JI1RHo3Xc/izQBubMQ5TEvQxeFIOEbkFj/MWjw7UOgQrQEozfhvmGvB3lqjdgO2e2RXYHc7RvwAfquZN9QWFFp7vS7JqhqGTg4+I0JNh28LDsdzeAXe7d4yLkJ5cl4EhU5a6Zd9Qo60JyO8HRAMSXQBuHMzTW0A4achARcTguyJUiCntxvyLiKPZGdGj7HsHfxr32S1ieejGDqxuOLTrssOgyxikWT+PqibWie+JDH20+ZP8l6ip8FdNaWcyzfED/SJybpRbDBvL3iXw9tb67SeRWKR8I91nyyLh69hwLHrp/IgboDlCW8/ZmOYoRWCJF4lH86v3312wuoU60x8IoSL7YhWW5N3WQpWxWeEmLlMFD0x6LcJclUeoIlpVNvR8wDNKeayHhdLChIs2ZiEUAAIaTcUKdWWccY7JraMosqKgS9BmnjLJLEei9kFEF+y97QxQ/q4AfyFPbajxSd7aujqXuUfqpL1aLgt65h1TyOKN3E3Y2faiTaR76EALyv2d4PdYHWhkhxXVATRhsG+N2Mg9FSCciGnD7wlu9IR28HrbLuvX7W2KsLDVdI2oBtfExTf8YQwPSk1vp28=,iv:VyhdbfiiQJqG6cKAz6WjmlG3MkM25VzQzfCt1qYgH4M=,tag:KIoEb/dkEPpeaCJaNkAflw==,type:str] wireguard: ENC[AES256_GCM,data:WUHMeYro1PS25wEtsQKHHtpLXbtox8JtqX5863dHelBIA2SB7YZ+eWyv5hQ=,iv:hGgR3UcFeVGZjWJjdnVuQeUQtz3p4Lh6QRBJDfTr9Qo=,tag:4qpU9Ue4QtfBINdy0CSdvw==,type:str] sops: kms: [] @@ -25,8 +24,8 @@ sops: dVZ3V0VUQzF5VzN0RFM5c0RjZHpJZ0EK09qgyPHEhHgRZt2GZQB5IM9Z/nfYXW28 fcfmF6pko9qOYQ72P7vwv8Xub0SEI8GKGQwz2QPDJT9gd1qtipuhuQ== -----END AGE ENCRYPTED FILE----- - lastmodified: "2024-01-09T06:00:09Z" - mac: ENC[AES256_GCM,data:WkXFwF0bHvFvNTlLKrGk6iQpk5RqMIapluqyv3rcKATP4S1rQSCXwlUn88TNfKeOsJ6pSqoBmwPNjufr9SNrPZZNKYZ4sA4yft9jgCeBcyX6TaPPA123qL8xM3C2TcaE1oBrG9fwmMgEJMYJA7LxBAXz4sW17geb/y4TZgUDwBw=,iv:VJzYR0dbT761ezejxOwPO6x8cKPAzMZtwZHWvPhiDzI=,tag:Xu43SfKeGgCJivfgk+vp3Q==,type:str] + lastmodified: "2024-06-04T10:16:20Z" + mac: ENC[AES256_GCM,data:NhVEt9Yg3J3+L1CqaI2IKFtC4VG9FdDkTOuDwc/hbwDvJmdbT7YocyQSX4IxsZ5ZxpaFXcp56C+QE5tDyjdWJs+njcxm8zDLsXaCfu3vLn7JHgzeQ9JeKeCzWV2oAj+PaTiY64QuhDP3LhaFZEZPEPJK5lGYR0XEZQHV2ngtF3U=,iv:LEkUb2cthtT+QG0SryRG17a5VRBli8PtRfhf1gTGBLo=,tag:G1Lo7tGUMWxgvSEQIuIAaw==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.8.1 diff --git a/os/common/configuration.nix b/os/common/configuration.nix index 4d2ac87..e075ac3 100644 --- a/os/common/configuration.nix +++ b/os/common/configuration.nix @@ -12,21 +12,17 @@ in ]; imports = [ ./modules/tmux.nix - ./modules/dev.nix ./modules/nix.nix ./modules/pppd.nix ./modules/stalwart-mail.nix ]; + system.stateVersion = "24.11"; sops = { defaultSopsFile = ../${host}/secrets.yaml; age.keyFile = "/var/secrets/${host}.sops"; }; - - system.stateVersion = "24.11"; - nix.settings.experimental-features = [ "flakes" "nix-command" ]; - boot = { tmp.useTmpfs = true; loader.timeout = 1; @@ -43,22 +39,21 @@ in "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL8LnyOuPmtKRqAZeHueNN4kfYvpRQVwCivSTq+SZvDU sinan@cez" ]; }; - time.timeZone = "Asia/Kolkata"; networking.useDHCP = false; environment = { - binsh = "${lib.getExe pkgs.dash}"; + binsh = lib.getExe pkgs.dash; systemPackages = with pkgs; [ dash - luajit neovim - sops ]; + variables = { EDITOR = "nvim"; VISUAL = "nvim"; }; + shellAliases = { ls = "ls --color=auto --group-directories-first"; grep = "grep --color=auto"; diff --git a/os/common/modules/dev.nix b/os/common/modules/dev.nix deleted file mode 100644 index eb00619..0000000 --- a/os/common/modules/dev.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config, pkgs, ... }: - -let - user = config.global.userdata.name; -in -{ - users.users.${user}.packages = with pkgs; [ - gcc - git - lua - - (python3.withPackages (p: with p; [ - pip - build - ])) - - man-pages - man-pages-posix - - ccls - lua-language-server - nil - nodePackages.bash-language-server - nodePackages.pyright - shellcheck - ]; - - documentation.dev.enable = true; -} diff --git a/os/pc/configuration.nix b/os/pc/configuration.nix new file mode 100644 index 0000000..4cd3a62 --- /dev/null +++ b/os/pc/configuration.nix @@ -0,0 +1,27 @@ +{ config, pkgs, ... }: let + user = config.global.userdata.name; +in { + imports = [ + ../common/configuration.nix + + ./modules/getty.nix + ./modules/sshfs.nix + ./modules/network.nix + ./modules/wayland.nix + ]; + + boot = { + consoleLogLevel = 3; + kernelPackages = pkgs.linuxPackages_latest; + }; + + sound.enable = true; + services.pipewire = { + enable = true; + pulse.enable = true; + }; + + documentation.dev.enable = true; + programs.adb.enable = true; + users.users.${user}.extraGroups = [ "adbusers" ]; +} diff --git a/os/cez/modules/getty.nix b/os/pc/modules/getty.nix index 8c7f57e..8c7f57e 100644 --- a/os/cez/modules/getty.nix +++ b/os/pc/modules/getty.nix diff --git a/os/pc/modules/network.nix b/os/pc/modules/network.nix new file mode 100644 index 0000000..6e07963 --- /dev/null +++ b/os/pc/modules/network.nix @@ -0,0 +1,10 @@ +{ ... }: { + networking.wireless.iwd = { + enable = true; + + settings = { + General.EnableNetworkConfiguration = true; + Network.NameResolvingService = "resolvconf"; + }; + }; +} diff --git a/os/cez/modules/sshfs.nix b/os/pc/modules/sshfs.nix index 5fdbeaf..2dbccce 100644 --- a/os/cez/modules/sshfs.nix +++ b/os/pc/modules/sshfs.nix @@ -1,18 +1,16 @@ -{ config, pkgs, ... }: - -let +{ config, pkgs, ... }: let domain = config.global.userdata.domain; user = config.global.userdata.name; uid = config.users.users.${user}.uid; gid = config.users.groups.users.gid; -in -{ - sops.secrets."misc/sftp" = {}; +in { + sops.secrets."misc/sftp".sopsFile = ../secrets.yaml; system.fsPackages = with pkgs; [ sshfs ]; fileSystems."/media/kay" = { device = "sftp@${domain}:"; fsType = "sshfs"; + options = [ "allow_other" # for non-root access "uid=${toString uid}" diff --git a/os/cez/modules/wayland.nix b/os/pc/modules/wayland.nix index 872c7fb..e609cd9 100644 --- a/os/cez/modules/wayland.nix +++ b/os/pc/modules/wayland.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: let +{ config, ... }: let user = config.global.userdata.name; fontSans = config.global.font.sans.name; @@ -9,9 +9,11 @@ in { fonts = { packages = fontPackages; enableDefaultPackages = true; + fontconfig = { hinting.style = "full"; subpixel.rgba = "rgb"; + defaultFonts = { monospace = [ fontMonospace ]; serif = [ fontSans ]; @@ -29,13 +31,6 @@ in { }; }; - programs = { - gnupg.agent = { - enable = true; - pinentryPackage = pkgs.pinentry-bemenu; - }; - }; - - security.pam.services.swaylock = {}; hardware.opengl.enable = true; + security.pam.services.swaylock = {}; } diff --git a/os/pc/secrets.yaml b/os/pc/secrets.yaml new file mode 100644 index 0000000..3e49d32 --- /dev/null +++ b/os/pc/secrets.yaml @@ -0,0 +1,31 @@ +misc: + sftp: ENC[AES256_GCM,data:xic1JI1RHo3Xc/izQBubMQ5TEvQxeFIOEbkFj/MWjw7UOgQrQEozfhvmGvB3lqjdgO2e2RXYHc7RvwAfquZN9QWFFp7vS7JqhqGTg4+I0JNh28LDsdzeAXe7d4yLkJ5cl4EhU5a6Zd9Qo60JyO8HRAMSXQBuHMzTW0A4achARcTguyJUiCntxvyLiKPZGdGj7HsHfxr32S1ieejGDqxuOLTrssOgyxikWT+PqibWie+JDH20+ZP8l6ip8FdNaWcyzfED/SJybpRbDBvL3iXw9tb67SeRWKR8I91nyyLh69hwLHrp/IgboDlCW8/ZmOYoRWCJF4lH86v3312wuoU60x8IoSL7YhWW5N3WQpWxWeEmLlMFD0x6LcJclUeoIlpVNvR8wDNKeayHhdLChIs2ZiEUAAIaTcUKdWWccY7JraMosqKgS9BmnjLJLEei9kFEF+y97QxQ/q4AfyFPbajxSd7aujqXuUfqpL1aLgt65h1TyOKN3E3Y2faiTaR76EALyv2d4PdYHWhkhxXVATRhsG+N2Mg9FSCciGnD7wlu9IR28HrbLuvX7W2KsLDVdI2oBtfExTf8YQwPSk1vp28=,iv:VyhdbfiiQJqG6cKAz6WjmlG3MkM25VzQzfCt1qYgH4M=,tag:KIoEb/dkEPpeaCJaNkAflw==,type:str] +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age1q5sfy74d53n6jxlgsc2zrsz4wcl9d830nxuagc3wfmdkrrp55ckq9ev6nv + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBLd3E0NC9Vb25ySXR0R0xL + b0pLcUdsNjYzZ0F6SkdodFZjT0s2OE5TZ0E0CkM5RHY4MmpBNFR6TWJLejlqS2FC + TmpRRUdMRkQ3SnhvY2ZtN3ZzYjRQYmsKLS0tIEZlWkRLVWJOaXV6V3Zmb2hUV0xj + d0N3S0ZIR0MyOERHV1k5RVBVVWVHQkkKZVtPjmpOPJM8STs70/nki6vTeo4mp47A + xEVUzxeUGpoyAewxSCo9W6IGtKyZQl0TEL3ucAmhOsjX4BWe2JShMA== + -----END AGE ENCRYPTED FILE----- + - recipient: age1nur989fnjmfgfk54ctczrwg25epqqr0xgkl5d4swfxka9aw6cdrqdawvaq + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBFWENJNzlDL1FpTkYwV1ps + V1VWeW4yOFZwZ1h5SGwzV2oyVkJaaHF0a1JRCmpFWWRLZzdUTUliZHpCTzJDYlhu + Yk51d1orS0tsMitBM0ZKSTQ4T05sNVEKLS0tIEVuZkY1bld2RldZOVNOc1E3bG5X + dVZ3V0VUQzF5VzN0RFM5c0RjZHpJZ0EK09qgyPHEhHgRZt2GZQB5IM9Z/nfYXW28 + fcfmF6pko9qOYQ72P7vwv8Xub0SEI8GKGQwz2QPDJT9gd1qtipuhuQ== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2024-06-04T10:15:07Z" + mac: ENC[AES256_GCM,data:zkxID1SWr9q7PQR4EVb/PaNVdS1xQdVcnwHlWzseqZrjEgyJLlupYKwEOw9eB4dY/R1VZx46BgI5Kk6rgbrIopnV3symARUOcqPUHM3lfz7h3S3sRJv547fu0UdQGp00HM1pW2nA5v6w8oY+H96+JdVtorrAt56B7EN6J28nb3M=,iv:p2gUIviAG3mBcMH6KUGmnvetWH9lb8ZlamSGOpbqins=,tag:adw9FMLJk5cUHmNmuRnZUQ==,type:str] + pgp: [] + unencrypted_suffix: _unencrypted + version: 3.8.1 |