diff --git a/nixos/configuration.nix b/configuration.nix similarity index 72% rename from nixos/configuration.nix rename to configuration.nix index f612140..c3106a6 100644 --- a/nixos/configuration.nix +++ b/configuration.nix @@ -9,6 +9,8 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix ./locals.nix + ./services.nix + ./software.nix ]; # Bootloader. @@ -36,12 +38,7 @@ # Enable the GNOME Desktop Environment. services.xserver.displayManager.gdm.enable = true; services.xserver.desktopManager.gnome.enable = true; - - # Configure keymap in X11 - services.xserver = { - layout = "us"; - xkbVariant = "euro"; - }; + services.gnome.core-utilities.enable = false; # disable all extra apps from gnome # Enable CUPS to print documents. services.printing.enable = true; @@ -76,20 +73,6 @@ ]; }; - # Install firefox. - programs.firefox.enable = true; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - wget - #openssh - ]; - # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; @@ -98,27 +81,13 @@ # enableSSHSupport = true; # }; - # List services that you want to enable: - - # Enable the OpenSSH daemon. - services.openssh = { - enable = true; - ports = [ 22 ]; - settings = { - PasswordAuthentication = false; - AllowUsers = freenen; # Allows all users by default. Can be [ "user1" "user2" ] - UseDns = true; - X11Forwarding = false; - PermitRootLogin = "no"; - }; + # Automatic Garbage Collection + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 14d"; }; - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ 22 ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave @@ -126,5 +95,4 @@ # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "24.05"; # Did you read the comment? - } diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..09d8af3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,16 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; + nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1"; + }; + + outputs = { nixpkgs, nix-flatpak, ... }: { + nixosConfigurations.frdesktop = nixpkgs.lib.nixosSystem { + modules = [ + nix-flatpak.nixosModules.nix-flatpak + + ./configuration.nix + ]; + }; + }; +} \ No newline at end of file diff --git a/nixos/hardware-configuration.nix b/hardware-configuration.nix similarity index 100% rename from nixos/hardware-configuration.nix rename to hardware-configuration.nix diff --git a/nixos/locals.nix b/locals.nix similarity index 82% rename from nixos/locals.nix rename to locals.nix index 1d2a9db..f30293a 100644 --- a/nixos/locals.nix +++ b/locals.nix @@ -1,4 +1,10 @@ { + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = "euro"; + }; + # Set your time zone. time.timeZone = "Europe/Amsterdam"; diff --git a/services.nix b/services.nix new file mode 100644 index 0000000..5d1d23c --- /dev/null +++ b/services.nix @@ -0,0 +1,20 @@ +{ + # Enable the OpenSSH daemon. + services.openssh = { + enable = true; + ports = [ 22 ]; + settings = { + PasswordAuthentication = true; + AllowUsers = [ "freenen" ]; + UseDns = true; + X11Forwarding = false; + PermitRootLogin = "no"; + }; + }; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ 22 ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; +} diff --git a/software.nix b/software.nix new file mode 100644 index 0000000..c199776 --- /dev/null +++ b/software.nix @@ -0,0 +1,144 @@ +{ config, pkgs, lib, ... }: { + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim wget git ncdu btop + gcc cmake valgrind clang-tools + vscodium + gnome.nautilus + libsForQt5.kalgebra + texliveFull + ]; + + services.flatpak.enable = true; + xdg.portal = { + enable = true; + config.common.default = [ "gtk" ]; + }; + services.flatpak.remotes = lib.mkOptionDefault [{ + name = "flathub"; location = "https://dl.flathub.org/repo/flathub.flatpakrepo"; + }]; + services.flatpak.update.auto = { + enable = true; + onCalendar = "weekly"; + }; + + services.flatpak.packages = [ + "org.mozilla.firefox" + "md.obsidian.Obsidian" + "org.mozilla.Thunderbird" + "com.discordapp.Discord" + "com.github.IsmaelMartinez.teams_for_linux" + "org.signal.Signal" + "org.telegram.desktop" + "com.github.tchx84.Flatseal" + "com.yubico.yubioath" + "org.filezillaproject.Filezilla" + "com.nextcloud.desktopclient.nextcloud" + "org.gnome.moserial" + "org.raspberrypi.rpi-imager" + "org.sdrangel.SDRangel" + "com.makemkv.MakeMKV" + "fr.handbrake.ghb" + "com.valvesoftware.Steam" + "com.mojang.Minecraft" + "org.gimp.GIMP" + "org.inkscape.Inkscape" + "org.videolan.VLC" + "org.gnome.Rhythmbox3" + "org.audacityteam.Audacity" + "com.prusa3d.PrusaSlicer" + "org.freecadweb.FreeCAD" + "org.kicad.KiCad" + ]; + services.flatpak.overrides = { + global = { + # Force Wayland by default + Context.sockets = [ + "wayland" "!x11" "!fallback-x11" + ]; + Context.filesystems = [ + "!host" + "!home" + ]; + Environment = { + XCURSOR_PATH = "/run/host/user-share/icons:/run/host/share/icons"; # Fix un-themed cursor in some Wayland apps + GTK_THEME = "Adwaita:dark"; # Force correct theme for some GTK apps + }; + }; + + "md.obsidian.Obsidian".Context = { + filesystems = [ + "~/.ssh:ro" + "xdg-config/git:ro" + "~/git/kladjes:rw" + "!/run/media" "!/media" "!/mnt" + ]; + }; + + "org.filezillaproject.Filezilla".Context = { + filesystems = [ + "xdg-documents:rw" + "xdg-downloads:rw" + ]; + }; + + "com.nextcloud.desktopclient.nextcloud".Context = { + filesystems = [ + "~/datatjes:rw" + ]; + }; + + "org.gimp.GIMP".Context = { + filesystems = [ + "xdg-documents:rw" + "xdg-downloads:rw" + ]; + }; + + "org.inkscape.Inkscape".Context = { + filesystems = [ + "xdg-documents:rw" + "xdg-downloads:rw" + ]; + }; + + "org.videolan.VLC".Context = { + filesystems = [ + "xdg-videos" + ]; + }; + + "org.audacityteam.Audacity".Context = { + filesystems = [ + "xdg-documents:rw" + "xdg-downloads:rw" + ]; + }; + + "com.prusa3d.PrusaSlicer".Context = { + filesystems = [ + "xdg-documents:rw" + "xdg-downloads:rw" + ]; + }; + + "org.freecadweb.FreeCAD".Context = { + filesystems = [ + "xdg-documents:rw" + "xdg-downloads:rw" + ]; + }; + + "org.kicad.KiCad".Context = { + filesystems = [ + "xdg-documents:rw" + "xdg-downloads:rw" + ]; + }; + }; +}