From d3a1b15bca2a494b4addbdd978e4639cc8b7955b Mon Sep 17 00:00:00 2001 From: Tasia Iso Date: Mon, 8 Apr 2024 20:32:17 +0200 Subject: [PATCH] Initial commit --- .gitignore | 2 + common/adguardhome.nix | 5 + common/de/hyprland.nix | 3 + common/de/plasma5.nix | 8 + common/de/plasma6.nix | 17 ++ common/default.nix | 196 +++++++++++++++++++++++ common/hardware/amdgpu.nix | 16 ++ common/hardware/intelcpu.nix | 3 + common/locales/en.nix | 17 ++ common/locales/fr-keymap.nix | 7 + common/locales/fr.nix | 17 ++ flake.lock | 66 ++++++++ flake.nix | 95 +++++++++++ hosts/phoenix/configuration.nix | 133 +++++++++++++++ hosts/phoenix/hardware-configuration.nix | 58 +++++++ hosts/phoenix/home.nix | 68 ++++++++ hosts/phoenix/syncthing.nix | 13 ++ hosts/stuff/configuration.nix | 40 +++++ hosts/stuff/hardware-configuration.nix | 43 +++++ hosts/stuff/home.nix | 68 ++++++++ hosts/stuff/syncthing.nix | 12 ++ modules/home-manager/default.nix | 6 + modules/nixos/default.nix | 6 + overlays/default.nix | 23 +++ pkgs/default.nix | 6 + pkgs/tildefriends/default.nix | 51 ++++++ 26 files changed, 979 insertions(+) create mode 100644 .gitignore create mode 100644 common/adguardhome.nix create mode 100644 common/de/hyprland.nix create mode 100644 common/de/plasma5.nix create mode 100644 common/de/plasma6.nix create mode 100644 common/default.nix create mode 100644 common/hardware/amdgpu.nix create mode 100644 common/hardware/intelcpu.nix create mode 100644 common/locales/en.nix create mode 100644 common/locales/fr-keymap.nix create mode 100644 common/locales/fr.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/phoenix/configuration.nix create mode 100644 hosts/phoenix/hardware-configuration.nix create mode 100644 hosts/phoenix/home.nix create mode 100644 hosts/phoenix/syncthing.nix create mode 100644 hosts/stuff/configuration.nix create mode 100644 hosts/stuff/hardware-configuration.nix create mode 100644 hosts/stuff/home.nix create mode 100644 hosts/stuff/syncthing.nix create mode 100644 modules/home-manager/default.nix create mode 100644 modules/nixos/default.nix create mode 100644 overlays/default.nix create mode 100644 pkgs/default.nix create mode 100644 pkgs/tildefriends/default.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5878b89 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +result +NOTES.md \ No newline at end of file diff --git a/common/adguardhome.nix b/common/adguardhome.nix new file mode 100644 index 0000000..ecf1a95 --- /dev/null +++ b/common/adguardhome.nix @@ -0,0 +1,5 @@ +{ + services.adguardhome.enable = true; + + networking.nameservers = ["127.0.0.1"]; +} \ No newline at end of file diff --git a/common/de/hyprland.nix b/common/de/hyprland.nix new file mode 100644 index 0000000..98dfe35 --- /dev/null +++ b/common/de/hyprland.nix @@ -0,0 +1,3 @@ +{ + programs.hyprland.enable = true; +} diff --git a/common/de/plasma5.nix b/common/de/plasma5.nix new file mode 100644 index 0000000..3606312 --- /dev/null +++ b/common/de/plasma5.nix @@ -0,0 +1,8 @@ +{ + services.xserver = { + enable = true; + + displayManager.sddm.enable = true; + desktopManager.plasma5.enable = true; + }; +} diff --git a/common/de/plasma6.nix b/common/de/plasma6.nix new file mode 100644 index 0000000..4115d6d --- /dev/null +++ b/common/de/plasma6.nix @@ -0,0 +1,17 @@ +{ + services.desktopManager.plasma6.enable = true; + + services.xserver = { + enable = true; + libinput.enable = true; + + displayManager = { + defaultSession = "plasma"; + + sddm = { + enable = true; + wayland.enable = true; + }; + }; + }; +} diff --git a/common/default.nix b/common/default.nix new file mode 100644 index 0000000..69b81a5 --- /dev/null +++ b/common/default.nix @@ -0,0 +1,196 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + imports = [ + # 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 + + # You can also split up your configuration and import pieces of it here: + # ./users.nix + ]; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + + nix.settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + }; + + boot = { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + }; + + # Set your time zone. + time.timeZone = "Europe/Paris"; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + users.defaultUserShell = pkgs.zsh; + + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + + shellAliases = { + ll = "ls -al"; + }; + # history.size = 10000; + # history.path = "${config.xdg.dataHome}/zsh/history"; + ohMyZsh = { + enable = true; + plugins = [ + "git" + # "thefuck" + ]; + theme = "robbyrussell"; + }; + }; + + services.fwupd.enable = true; + + programs.neovim = { + enable = true; + defaultEditor = true; + + configure = { + customRC = '' + set number + set list + if &diff + colorscheme blue + endif + ''; + packages.myVimPackage = with pkgs.vimPlugins; { + start = [ + ctrlp + nvim-tree-lua + indent-blankline-nvim + + nvim-lspconfig + nvim-treesitter.withAllGrammars + plenary-nvim + gruvbox-material + mini-nvim + ]; + }; + + extraLuaConfig = + /* + lua + */ + '' + require("nvim-tree").setup() + ''; + }; + }; + + networking = { + networkmanager.enable = true; + + firewall.enable = true; + }; + + nix.settings.allowed-users = ["@wheel"]; + + security = { + #auditd.enable = true; + #audit.enable = true; + #audit.rules = [ + # "-a exit,always -F arch=b64 -S execve" + #]; + + sudo.execWheelOnly = true; + }; + + services.tailscale.enable = true; + + environment.systemPackages = with pkgs; [ + wget + dig + nmap + btop + gitFull + smartmontools + lm_sensors + pciutils + gcc + gnumake + sysstat + file + ffmpeg + syncthing + + kate + partition-manager + gparted + librewolf + vscodium + vlc + filelight + libreoffice + ]; +} diff --git a/common/hardware/amdgpu.nix b/common/hardware/amdgpu.nix new file mode 100644 index 0000000..29ee926 --- /dev/null +++ b/common/hardware/amdgpu.nix @@ -0,0 +1,16 @@ +{ + boot = { + initrd.kernelModules = ["amdgpu"]; + + # params for Sea Islands or smth + kernelParams = ["radeon.cik_support=0" "amdgpu.cik_support=1"]; + }; + + hardware.opengl = { + enable = true; # Mesa + driSupport = true; # Vulkan + driSupport32Bit = true; + }; + + services.xserver.videoDrivers = ["amdgpu"]; +} diff --git a/common/hardware/intelcpu.nix b/common/hardware/intelcpu.nix new file mode 100644 index 0000000..ec52660 --- /dev/null +++ b/common/hardware/intelcpu.nix @@ -0,0 +1,3 @@ +{ + hardware.cpu.intel.updateMicrocode = true; +} diff --git a/common/locales/en.nix b/common/locales/en.nix new file mode 100644 index 0000000..5e44a81 --- /dev/null +++ b/common/locales/en.nix @@ -0,0 +1,17 @@ +{ + time.timeZone = "Europe/Paris"; + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; +} diff --git a/common/locales/fr-keymap.nix b/common/locales/fr-keymap.nix new file mode 100644 index 0000000..db054a7 --- /dev/null +++ b/common/locales/fr-keymap.nix @@ -0,0 +1,7 @@ +{ + console.keyMap = "fr"; + + services.xserver.xkb = { + layout = "fr"; + }; +} diff --git a/common/locales/fr.nix b/common/locales/fr.nix new file mode 100644 index 0000000..bd112b0 --- /dev/null +++ b/common/locales/fr.nix @@ -0,0 +1,17 @@ +{ + time.timeZone = "Europe/Paris"; + i18n = { + defaultLocale = "fr_FR.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "fr_FR.UTF-8"; + LC_IDENTIFICATION = "fr_FR.UTF-8"; + LC_MEASUREMENT = "fr_FR.UTF-8"; + LC_MONETARY = "fr_FR.UTF-8"; + LC_NAME = "fr_FR.UTF-8"; + LC_NUMERIC = "fr_FR.UTF-8"; + LC_PAPER = "fr_FR.UTF-8"; + LC_TELEPHONE = "fr_FR.UTF-8"; + LC_TIME = "fr_FR.UTF-8"; + }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..67383ed --- /dev/null +++ b/flake.lock @@ -0,0 +1,66 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712386041, + "narHash": "sha256-dA82pOMQNnCJMAsPG7AXG35VmCSMZsJHTFlTHizpKWQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "d6bb9f934f2870e5cbc5b94c79e9db22246141ff", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1712439257, + "narHash": "sha256-aSpiNepFOMk9932HOax0XwNxbA38GOUVOiXfUVPOrck=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ff0dbd94265ac470dda06a657d5fe49de93b4599", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1712439257, + "narHash": "sha256-aSpiNepFOMk9932HOax0XwNxbA38GOUVOiXfUVPOrck=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ff0dbd94265ac470dda06a657d5fe49de93b4599", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..03c4f16 --- /dev/null +++ b/flake.nix @@ -0,0 +1,95 @@ +{ + description = "Your new nix config"; + + inputs = { + # Nixpkgs + # nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + # You can access packages and modules from different nixpkgs revs + # at the same time. Here's an working example: + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. + + # Home manager + home-manager.url = "github:nix-community/home-manager/release-23.11"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + # 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 = { + self, + nixpkgs, + home-manager, + ... + } @ inputs: let + inherit (self) outputs; + # Supported systems for your flake packages, shell, etc. + systems = [ + "aarch64-linux" + "i686-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; + # Reusable home-manager modules you might want to export + # These are usually stuff you would upstream into home-manager + homeManagerModules = import ./modules/home-manager; + + # NixOS configuration entrypoint + # Available through 'nixos-rebuild build --flake .#phoenix' + nixosConfigurations = { + phoenix = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [ + ./hosts/phoenix/configuration.nix + ]; + }; + + stuff = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [ + ./hosts/stuff/configuration.nix + ]; + }; + }; + + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#user@phoenix' + # homeConfigurations = { + # "user@phoenix" = home-manager.lib.homeManagerConfiguration { + # pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + # extraSpecialArgs = {inherit inputs outputs;}; + # modules = [ + # ./hosts/phoenix/home.nix + # ]; + # }; + # "user@stuff" = home-manager.lib.homeManagerConfiguration { + # pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + # extraSpecialArgs = {inherit inputs outputs;}; + # modules = [ + # ./hosts/stuff/home.nix + # ]; + # }; + # }; + }; +} diff --git a/hosts/phoenix/configuration.nix b/hosts/phoenix/configuration.nix new file mode 100644 index 0000000..aa678b0 --- /dev/null +++ b/hosts/phoenix/configuration.nix @@ -0,0 +1,133 @@ +{pkgs, ...}: { + imports = [ + ./hardware-configuration.nix + ../../common/default.nix + + ../../common/locales/en.nix + ../../common/locales/fr-keymap.nix + ../../common/hardware/intelcpu.nix + ../../common/hardware/amdgpu.nix + + ../../common/de/plasma6.nix + ../../common/de/hyprland.nix + + ./syncthing.nix + ../../common/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 + ]; + + boot = { + kernelPackages = pkgs.linuxPackages_latest; + # boot.kernelModules = [ "fuse" "kvm-intel" "coretemp" ]; + }; + + networking = { + hostName = "phoenix"; + + firewall.enable = true; + firewall.allowedTCPPorts = [8080 12345 13378]; + firewall.allowedUDPPorts = [8080]; + }; + + users.users.user = { + isNormalUser = true; + description = "User"; + extraGroups = ["networkmanager" "wheel" "dialout" "syncthing"]; + initialPassword = "correcthorsebatterystaple"; + openssh.authorizedKeys.keys = [ + # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect + ]; + }; + + + services.btrfs.autoScrub = { + enable = true; + interval = "weekly"; + fileSystems = ["/" "/data"]; + }; + + virtualisation.docker.enable = true; + services.flatpak.enable = true; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + programs.mtr.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + programs.steam = { + enable = true; + remotePlay.openFirewall = false; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = false; # Open ports in the firewall for Source Dedicated Server + }; + + environment.systemPackages = with pkgs; [ + bitwarden + libreoffice-fresh + 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 + system.stateVersion = "23.05"; +} diff --git a/hosts/phoenix/hardware-configuration.nix b/hosts/phoenix/hardware-configuration.nix new file mode 100644 index 0000000..d267d6a --- /dev/null +++ b/hosts/phoenix/hardware-configuration.nix @@ -0,0 +1,58 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/469da268-3ac1-4591-9209-26c89afb2e59"; + fsType = "btrfs"; + options = ["subvol=@"]; + }; + + boot.initrd.luks.devices."luks-06613ddd-abd6-409e-9a33-889cb9d15d11".device = "/dev/disk/by-uuid/06613ddd-abd6-409e-9a33-889cb9d15d11"; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/E398-A9BF"; + fsType = "vfat"; + }; + + fileSystems."/data" = { + device = "/dev/disk/by-uuid/648ae2f4-bd2e-4315-b12f-72733f92d2e0"; + fsType = "btrfs"; + }; + + boot.initrd.luks.devices."539c1a57-e6d0-4ff0-927a-8f0d4aa4c9c7".device = "/dev/disk/by-uuid/539c1a57-e6d0-4ff0-927a-8f0d4aa4c9c7"; + + fileSystems."/home" = { + device = "/dev/disk/by-uuid/469da268-3ac1-4591-9209-26c89afb2e59"; + fsType = "btrfs"; + options = ["subvol=@home"]; + }; + + swapDevices = []; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.eno1.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/phoenix/home.nix b/hosts/phoenix/home.nix new file mode 100644 index 0000000..de643e7 --- /dev/null +++ b/hosts/phoenix/home.nix @@ -0,0 +1,68 @@ +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other home-manager modules here + imports = [ + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example + + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules.default + + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix + ]; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = _: true; + }; + }; + + home = { + username = "user"; + homeDirectory = "/home/user"; + }; + + # Add stuff for your user as you see fit: + # programs.neovim.enable = true; + # home.packages = with pkgs; [ steam ]; + + # Enable home-manager and git + programs.home-manager.enable = true; + programs.git.enable = true; + + # Nicely reload system units when changing configs + systemd.user.startServices = "sd-switch"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "23.05"; +} diff --git a/hosts/phoenix/syncthing.nix b/hosts/phoenix/syncthing.nix new file mode 100644 index 0000000..6269568 --- /dev/null +++ b/hosts/phoenix/syncthing.nix @@ -0,0 +1,13 @@ +{ + services.syncthing = { + enable = true; + user = "user"; + group = "users"; + dataDir = "/home/user"; + configDir = "/data/sync/configuration/"; + + openDefaultPorts = true; + overrideFolders = false; + overrideDevices = false; + }; +} diff --git a/hosts/stuff/configuration.nix b/hosts/stuff/configuration.nix new file mode 100644 index 0000000..a3e2465 --- /dev/null +++ b/hosts/stuff/configuration.nix @@ -0,0 +1,40 @@ +{pkgs, ...}: { + imports = [ + ./hardware-configuration.nix + ../../common/default.nix + + ../../common/locales/fr.nix + ../../common/locales/fr-keymap.nix + ../../common/hardware/intelcpu.nix + + ../../common/de/plasma5.nix + + ./syncthing.nix + # ../../common/adguardhome.nix + ]; + + users.users.user = { + isNormalUser = true; + description = "User"; + extraGroups = ["networkmanager" "wheel" "dialout" "syncthing"]; + initialPassword = "correcthorsebatterystaple"; + openssh.authorizedKeys.keys = [ + # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect + ]; + }; + + networking = { + hostName = "stuff"; + + firewall.enable = true; + #firewall.allowedTCPPorts = [ ]; + #firewall.allowedUDPPorts = [ ]; + }; + + environment.systemPackages = with pkgs; [ + # Additional system packages here + ]; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "23.11"; +} diff --git a/hosts/stuff/hardware-configuration.nix b/hosts/stuff/hardware-configuration.nix new file mode 100644 index 0000000..890b2e4 --- /dev/null +++ b/hosts/stuff/hardware-configuration.nix @@ -0,0 +1,43 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = ["xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "rtsx_pci_sdmmc"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/699da114-1ef6-4887-9083-a03eb9e51049"; + fsType = "btrfs"; + options = ["subvol=@"]; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/C0F6-5EAB"; + fsType = "vfat"; + }; + + swapDevices = []; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp4s0f2.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/stuff/home.nix b/hosts/stuff/home.nix new file mode 100644 index 0000000..b859584 --- /dev/null +++ b/hosts/stuff/home.nix @@ -0,0 +1,68 @@ +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other home-manager modules here + imports = [ + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example + + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules.default + + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix + ]; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = _: true; + }; + }; + + home = { + username = "user"; + homeDirectory = "/home/user"; + }; + + # Add stuff for your user as you see fit: + # programs.neovim.enable = true; + # home.packages = with pkgs; [ steam ]; + + # Enable home-manager and git + programs.home-manager.enable = true; + programs.git.enable = true; + + # Nicely reload system units when changing configs + systemd.user.startServices = "sd-switch"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "23.11"; +} diff --git a/hosts/stuff/syncthing.nix b/hosts/stuff/syncthing.nix new file mode 100644 index 0000000..d699916 --- /dev/null +++ b/hosts/stuff/syncthing.nix @@ -0,0 +1,12 @@ +{ + services.syncthing = { + enable = true; + user = "user"; + group = "users"; + dataDir = "/home/user"; + + openDefaultPorts = true; + overrideFolders = false; + overrideDevices = false; + }; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..45aae31 --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,6 @@ +# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..8605069 --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,6 @@ +# Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..a13ea3c --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,23 @@ +# This file defines overlays +{inputs, ...}: { + # This one brings our custom packages from the 'pkgs' directory + additions = final: _prev: import ../pkgs {pkgs = final;}; + + # This one contains whatever you want to overlay + # You can change versions, add patches, set compilation flags, anything really. + # https://nixos.wiki/wiki/Overlays + modifications = final: prev: { + # example = prev.example.overrideAttrs (oldAttrs: rec { + # ... + # }); + }; + + # When applied, the unstable nixpkgs set (declared in the flake inputs) will + # be accessible through 'pkgs.unstable' + unstable-packages = final: _prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + config.allowUnfree = true; + }; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..8af3a80 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,6 @@ +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' +{ pkgs, ... }: +{ + tildefriends = pkgs.callPackage ./tildefriends/default.nix { }; +} diff --git a/pkgs/tildefriends/default.nix b/pkgs/tildefriends/default.nix new file mode 100644 index 0000000..76dbdd4 --- /dev/null +++ b/pkgs/tildefriends/default.nix @@ -0,0 +1,51 @@ +{ lib +, stdenv +, fetchFromGitea +, gnumake +, openssl +, which +}: + +stdenv.mkDerivation rec { + pname = "tildefriends"; + version = "0.0.17"; + + src = fetchFromGitea { + domain = "dev.tildefriends.net"; + owner = "cory"; + repo = "tildefriends"; + rev = "v${version}"; + hash = "sha256-Wc9MvafA2rPmjnRvmMB3qmRyDQNhF688weKItHw3E8I="; + }; + + nativeBuildInputs = [ + gnumake + openssl + which + ]; + + buildPhase = '' + make -j $NIX_BUILD_CORES release + ''; + + installPhase = '' + mkdir -p $out/bin + + cp -r out/release/* $out/bin + ''; + + doCheck = false; + + meta = { + homepage = "https://tildefriends.net/"; + description = "Make apps and friends from the comfort of your web browser."; + longDescription = '' + TODO + ''; + + mainProgram = "tildefriends"; + license = with lib.licenses; [ mit ]; + maintainers = with lib.maintainers; [ tasiaiso ]; + platforms = lib.platforms.all; + }; +}