From 00eefb0cbc8206fc6eb4249f3ad8ad34e657c913 Mon Sep 17 00:00:00 2001 From: Tasia Iso Date: Wed, 17 Apr 2024 22:28:27 +0200 Subject: [PATCH] something --- README.md | 45 +++++++++++++++++-- common/allow-unfree.nix | 4 +- common/de/plasma-packages.nix | 6 +-- common/de/plasma5.nix | 6 +-- common/de/plasma6.nix | 4 +- common/default.nix | 1 + common/full-install.nix | 28 +----------- common/hardware/raspberry-pi.nix | 4 +- common/hardware/ssd.nix | 3 ++ common/locales/en.nix | 2 +- common/locales/fr.nix | 2 +- common/packages/zsh.nix | 21 +++++++++ common/tasia-packages.nix | 59 ++++++++++++++++++++++++ flake.nix | 17 +++---- hosts/README.md | 17 ------- hosts/new-phoenix/configuration.nix | 5 +++ hosts/pc/configuration.nix | 17 ++----- hosts/phoenix/configuration.nix | 69 +++-------------------------- 18 files changed, 161 insertions(+), 149 deletions(-) create mode 100644 common/hardware/ssd.nix create mode 100644 common/packages/zsh.nix create mode 100644 common/tasia-packages.nix delete mode 100644 hosts/README.md diff --git a/README.md b/README.md index 5115fa7..f61732f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,46 @@ +# My NixOS config + +## File system structure + +- `common`: stores all Nix files which are shared by all system configs + - `de`: Desktop environments and their parameters + - `hardware`: self-explenatory + - `locales`: localization options + - `packages`: services & packages with common configurations + - `default.nix`: The minimum configuration that a machine needs + - `full-install.nix`: if this machine has a DE or is going to be used by a human + - `tasia-packages.nix`: Collection of additional packages +- `hosts`: Machine-specific configurations +- `modules/nixos`: Custom NixOS modules +- `overlays`: Custom NixOS overlays +- `pkgs`: Custom NixOS packages + +## Memo + +Update channels: `nix flake update` + +Build a configuration: `# nixos-rebuild switch --flake .#phoenix` + +Build enry and upload a generation: TODO + +# Hosts + +## pc + +My main PC. Mostly unused because of power constraints + ## phoenix -phoenix ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJTqExIIZuW9yvK7mgveNK8KDGKaRswrjj/nwVDwUdeL +`phoenix ssh-ed25519 AAAAC3Nza C1lZDI1NTE5AAAAIJTqExIIZuW9yvK7mgveNK8KDGKaRswrjj/nwVDwUdeL` -## enry +My old laptop. -enry ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHCPPE7U87PZ4+BQrdJtPuD/ibf9ubyPAqcRJe6Lpc2D \ No newline at end of file +## stuff + +Another person's laptop. + +### enry + +`enry ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHCPPE7U87PZ4+BQrdJtPuD/ibf9ubyPAqcRJe6Lpc2D` + +This is my Raspberry Pi 3B+ inside my electrical cabinet. \ No newline at end of file diff --git a/common/allow-unfree.nix b/common/allow-unfree.nix index c118726..c931c2a 100644 --- a/common/allow-unfree.nix +++ b/common/allow-unfree.nix @@ -1,8 +1,8 @@ -{ pkgs,... }: { +{pkgs, ...}: { # Allows non-free packages to be installed nixpkgs = { config = { allowUnfree = true; }; }; -} \ No newline at end of file +} diff --git a/common/de/plasma-packages.nix b/common/de/plasma-packages.nix index 3faf6d9..7c5ab5b 100644 --- a/common/de/plasma-packages.nix +++ b/common/de/plasma-packages.nix @@ -1,8 +1,8 @@ -{ pkgs, ...}: { +{pkgs, ...}: { environment.systemPackages = with pkgs; [ # See ./plasma6.nix ksshaskpass - + libreoffice kleopatra kate @@ -13,4 +13,4 @@ vlc filelight ]; -} \ No newline at end of file +} diff --git a/common/de/plasma5.nix b/common/de/plasma5.nix index a800835..d128dff 100644 --- a/common/de/plasma5.nix +++ b/common/de/plasma5.nix @@ -1,5 +1,5 @@ -{ pkgs, ...}: { - imports = [ +{pkgs, ...}: { + imports = [ ./plasma-packages.nix ]; @@ -13,7 +13,7 @@ # Use ksshaskpass to access stored secrets environment.sessionVariables = rec { - GIT_ASKPASS=ksshaskpass + GIT_ASKPASS = "ksshaskpass"; }; programs.kdeconnect = { diff --git a/common/de/plasma6.nix b/common/de/plasma6.nix index 7347178..885689f 100644 --- a/common/de/plasma6.nix +++ b/common/de/plasma6.nix @@ -1,5 +1,5 @@ -{ pkgs, ...}: { - imports = [ +{pkgs, ...}: { + imports = [ ./plasma-packages.nix ]; diff --git a/common/default.nix b/common/default.nix index 830c09c..22a720f 100644 --- a/common/default.nix +++ b/common/default.nix @@ -8,6 +8,7 @@ }: { imports = [ ./packages/neovim.nix + ./packages/zsh.nix ]; nixpkgs = { diff --git a/common/full-install.nix b/common/full-install.nix index 2cbf1a8..688c7a8 100644 --- a/common/full-install.nix +++ b/common/full-install.nix @@ -1,7 +1,4 @@ -{ - pkgs, - ... -}: { +{pkgs, ...}: { # Enable CUPS to print documents. services.printing.enable = true; @@ -16,28 +13,7 @@ pulse.enable = true; }; - # Z Shell - programs.zsh = { - enable = true; - enableCompletion = true; - autosuggestions.enable = true; - syntaxHighlighting.enable = true; - - shellAliases = { - ll = "ls -al"; - }; - - ohMyZsh = { - enable = true; - plugins = [ - "git" - ]; - theme = "robbyrussell"; - }; - }; - users.defaultUserShell = pkgs.zsh; - environment.systemPackages = with pkgs; [ # ]; -} \ No newline at end of file +} diff --git a/common/hardware/raspberry-pi.nix b/common/hardware/raspberry-pi.nix index 28d6d53..3be59c2 100644 --- a/common/hardware/raspberry-pi.nix +++ b/common/hardware/raspberry-pi.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{lib, ...}: { # Disable systemd-boot boot.loader = { systemd-boot = { @@ -13,4 +13,4 @@ # firmware hardware.enableRedistributableFirmware = true; -} \ No newline at end of file +} diff --git a/common/hardware/ssd.nix b/common/hardware/ssd.nix new file mode 100644 index 0000000..9f2c39b --- /dev/null +++ b/common/hardware/ssd.nix @@ -0,0 +1,3 @@ +{ + services.fstrim.enable = true; +} \ No newline at end of file diff --git a/common/locales/en.nix b/common/locales/en.nix index f54f58d..9693e4b 100644 --- a/common/locales/en.nix +++ b/common/locales/en.nix @@ -1,6 +1,6 @@ { time.timeZone = "Europe/Paris"; - + i18n = { defaultLocale = "en_US.UTF-8"; extraLocaleSettings = { diff --git a/common/locales/fr.nix b/common/locales/fr.nix index 52c7e03..c1131b9 100644 --- a/common/locales/fr.nix +++ b/common/locales/fr.nix @@ -1,6 +1,6 @@ { time.timeZone = "Europe/Paris"; - + i18n = { defaultLocale = "fr_FR.UTF-8"; extraLocaleSettings = { diff --git a/common/packages/zsh.nix b/common/packages/zsh.nix new file mode 100644 index 0000000..33dcc24 --- /dev/null +++ b/common/packages/zsh.nix @@ -0,0 +1,21 @@ +{pkgs, ...}: { + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + + shellAliases = { + ll = "ls -al"; + }; + + ohMyZsh = { + enable = true; + plugins = [ + "git" + ]; + theme = "robbyrussell"; + }; + }; + users.defaultUserShell = pkgs.zsh; +} diff --git a/common/tasia-packages.nix b/common/tasia-packages.nix new file mode 100644 index 0000000..60c6429 --- /dev/null +++ b/common/tasia-packages.nix @@ -0,0 +1,59 @@ +{pkgs, ...}: { + environment.systemPackages = with pkgs; [ + bitwarden + nextdns + # android-tools + gocryptfs + #endless-sky + #gnucash + # obs-studio + # kdenlive + rustc + cargo + nodejs + rpi-imager + # wireshark + # appimage-run + #ssb-patchwork + simplex-chat-desktop + #android-studio + #swig + picard + kleopatra + qbittorrent + tor-browser + protonvpn-gui + # radicle-cli + # opensnitch-ui + yarn + nodePackages.node-gyp + nodePackages.node-pre-gyp + # superTuxKart + openssl + + # qgis + helix + holehe + smartmontools + cheat + lazygit + ripgrep + jq + yq + neofetch + tldr + bat + dust + powertop + fzf + atuin + zellij + eza + lapce + gotty + gping + yazi + + tildefriends + ]; +} diff --git a/flake.nix b/flake.nix index 6fbf928..26a3414 100644 --- a/flake.nix +++ b/flake.nix @@ -2,20 +2,10 @@ description = "My NixOS config"; inputs = { - # Nixpkgs nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + stable.url = "github:nixos/nixpkgs/nixos-23.11"; - # You can access packages and modules from different nixpkgs revs - # at the same time. Here's an working example: unstable.url = "github:nixos/nixpkgs/nixos-unstable"; - # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. - - # TODO: Add any other flake you might need - # hardware.url = "github:nixos/nixos-hardware"; - - # Shameless plug: looking for a way to nixify your themes and make - # everything match nicely? Try nix-colors! - # nix-colors.url = "github:misterio77/nix-colors"; }; outputs = { @@ -26,24 +16,29 @@ ... } @ inputs: let inherit (self) outputs; + # Supported systems for your flake packages, shell, etc. systems = [ "aarch64-linux" "x86_64-linux" ]; + # This is a function that generates an attribute by calling a function you # pass to it, with each system as an argument forAllSystems = nixpkgs.lib.genAttrs systems; in { + # Your custom packages # Accessible through 'nix build', 'nix shell', etc packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + # Formatter for your nix files, available through 'nix fmt' # Other options beside 'alejandra' include 'nixpkgs-fmt' formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); # Your custom packages and modifications, exported as overlays overlays = import ./overlays {inherit inputs;}; + # Reusable nixos modules you might want to export # These are usually stuff you would upstream into nixpkgs nixosModules = import ./modules/nixos; diff --git a/hosts/README.md b/hosts/README.md deleted file mode 100644 index 91ddc96..0000000 --- a/hosts/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Hosts - -## enry - -This is my Raspberry Pi 3B+ inside my electrical cabinet. - -## pc - -My main PC. - -## phoenix - -My old laptop. - -## stuff - -A friend's laptop. diff --git a/hosts/new-phoenix/configuration.nix b/hosts/new-phoenix/configuration.nix index d7b3fed..ff72008 100644 --- a/hosts/new-phoenix/configuration.nix +++ b/hosts/new-phoenix/configuration.nix @@ -12,6 +12,7 @@ ../../common/locales/fr-keymap.nix ../../common/hardware/intelcpu.nix # ../../common/hardware/amdgpu.nix + ../../common/hardware/ssd.nix ../../common/packages/syncthing.nix ../../common/packages/adguardhome.nix @@ -64,6 +65,10 @@ # Needed to build enry boot.binfmt.emulatedSystems = ["aarch64-linux"]; + environment.systemPackages = with pkgs; [ + # + ]; + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = "23.05"; } diff --git a/hosts/pc/configuration.nix b/hosts/pc/configuration.nix index 8208659..e16949f 100644 --- a/hosts/pc/configuration.nix +++ b/hosts/pc/configuration.nix @@ -13,19 +13,14 @@ ../../common/locales/en-keymap.nix ../../common/hardware/intelcpu.nix ../../common/hardware/nvidiagpu.nix + ../../common/hardware/ssd.nix ../../common/de/plasma6.nix ../../common/de/hyprland.nix ../../common/packages/syncthing.nix ../../common/packages/adguardhome.nix - - # If you want to use modules your own flake exports (from modules/nixos): - # outputs.nixosModules.example - - # Or modules from other flakes (such as nixos-hardware): - # inputs.hardware.nixosModules.common-cpu-amd - # inputs.hardware.nixosModules.common-ssd + ../../common/tasia-packages.nix ]; boot = { @@ -78,13 +73,7 @@ }; environment.systemPackages = with pkgs; [ - bitwarden - nextdns - obs-studio - kdenlive - rpi-imager - kleopatra - xonotic + # ]; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion diff --git a/hosts/phoenix/configuration.nix b/hosts/phoenix/configuration.nix index ab37070..a93bb38 100644 --- a/hosts/phoenix/configuration.nix +++ b/hosts/phoenix/configuration.nix @@ -13,21 +13,16 @@ ../../common/locales/fr-keymap.nix ../../common/hardware/intelcpu.nix ../../common/hardware/amdgpu.nix + ../../common/hardware/ssd.nix ../../common/de/plasma6.nix ../../common/de/hyprland.nix ../../common/packages/syncthing.nix ../../common/packages/adguardhome.nix - - # If you want to use modules your own flake exports (from modules/nixos): - # outputs.nixosModules.example + ../../common/tasia-packages.nix ../../modules/nixos/vedirect-reader.nix - - # Or modules from other flakes (such as nixos-hardware): - # inputs.hardware.nixosModules.common-cpu-amd - # inputs.hardware.nixosModules.common-ssd ]; boot = { @@ -48,7 +43,7 @@ allowedUDPPorts = [ 8080 # ? ]; - }; + }; }; users.users.user = { @@ -92,64 +87,10 @@ }; # Needed to build enry - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + boot.binfmt.emulatedSystems = ["aarch64-linux"]; environment.systemPackages = with pkgs; [ - bitwarden - nextdns - # android-tools - gocryptfs - #endless-sky - #gnucash - # obs-studio - # kdenlive - rustc - cargo - nodejs - rpi-imager - # wireshark - # appimage-run - #ssb-patchwork - simplex-chat-desktop - #android-studio - #swig - picard - kleopatra - qbittorrent - tor-browser - protonvpn-gui - # radicle-cli - # opensnitch-ui - yarn - nodePackages.node-gyp - nodePackages.node-pre-gyp - # superTuxKart - openssl - - # qgis - helix - holehe - smartmontools - cheat - lazygit - ripgrep - jq - yq - neofetch - tldr - bat - dust - powertop - fzf - atuin - zellij - eza - lapce - gotty - gping - yazi - - tildefriends + # ]; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion