/r/NixOS

Photograph via snooOG

NixOS is a Linux distribution with a unique approach to package and configuration management. In existing distributions, actions such as upgrades are dangerous: upgrading a package can cause other packages to break, upgrading an entire system is much less reliable than reinstalling from scratch, you can’t safely test what the results of a configuration change will be, you cannot easily undo changes to the system, and so on. We want to change that. NixOS has many innovative features:

http://nixos.org/nixos/

Part of the Free Culture Reddit Community!

The free culture movement is a social movement for freedom of speech and expression and the elimination of gatekeepers in a digital age. We promote free software and other free cultural works as a matter of personal liberty and human rights.

When we say "free", we mean free as in "freedom".

List of all Free Culture Reddits

/r/FreeCulture Sister Reddits (NEW! Please subscribe and start submitting):

More featured Reddits (NEW! Please subscribe and start submitting):

Make sure your works are free by using a free culture license. Noncommercial ironically is nonfree, so choose a free license! For software, check out the FSF's license recommendations guide, and for other cultural works use one of the following licenses.

Copyleft:

Permissive:

  • CC-BY (Creative Commons Attribution)
  • CC0 (Creative Commons Zero)

/r/NixOS

31,278 Subscribers

1

Impermanence setup strange behavior

I am playing around with an impermanent setup structured closely to the vimjoyer tutorial but using my own configuration. At first when installing I just had an initialPassword set for my user:

users.users.grig109 = {

isNormalUser = true;

initialPassword = "1";

description = "grig109";

extraGroups = ["networkmanager" "wheel"];

packages = with pkgs; [];

shell = pkgs.nushell;

};

I obviously wanted to change the password and quickly realized I couldn't just set a new password using passwd command as this got wiped on reboot. I think I've figured out how to configure my password with the hashedPassword file option, but in my prior attempts based on searching online I had tried adding "/etc/shadow" or "etc/passwd" to the list of my persistent directories. Not only did this not work, but running "nixos-rebuild switch" after adding these directories seem to basically break the system and just immediately switch to "emergency mode" with a generation that wouldn't boot.

I have no idea what happened here when I tried to persist these directories, and it's made me a little hesitant to go further with impermanence.

I am curious if anyone else who has attempted an impermanent setup has any idea why persisting those directories would create this issue?

1 Comment
2024/11/22
07:44 UTC

1

Occasional freezing of terminal emulators

Happens in TTY, alacritty, and konsole. I type something, suddenly a complete freeze, and then about half a second later the letters I was typing show up. This happens multiple times each minute.

GUI programs are not affected at all. Just terminal emulators.

Using strace on a terminal, holding `d` I see this strange pattern:

pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, {sigmask=NULL, sigsetsize=8}) = 1 (in [0], left {tv_sec=0, tv_nsec=0})
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "d", 1)                         = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, {sigmask=NULL, sigsetsize=8}) = 1 (in [0], left {tv_sec=0, tv_nsec=0})
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "d", 1)                         = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, {sigmask=NULL, sigsetsize=8}) = 1 (in [0], left {tv_sec=0, tv_nsec=0})
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "d", 1)                         = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, {sigmask=NULL, sigsetsize=8}) = 0 (Timeout)
write(2, "dddddddddddddd", 14)          = 14

Suddenly a timeout returning 14 characters instead of just 1. What could be the cause of this?

Happening on kernel 6.12.0 nixpkgs 71e91c409d1e on intel arc 140V iGPU with 258V CPU, xe driver.

0 Comments
2024/11/22
06:57 UTC

10

Without flakes

Is it possible to have a setup and/or use NixOS without flakes?

Thanks

16 Comments
2024/11/22
04:35 UTC

1

How to deploy?

Hi, I’m a non-developer who likes NixOS.

I tinker and try stuff on an extra laptop. After a year I have a config with flakes that I’m happy with. There’s still a bunch I don’t understand but I keep feeling my way forward.

In the last month I’ve gotten serious about data sovereignty and home lab stuff, so I bought an old gaming computer. I wanted to use NixOS but I had some glitches that got me to distro hop. Now that I have that setup enough I want to go back and figure out how to overcome my stumbling blocks. The biggest one is how to deploy. With a new computer, no dual booting, fresh ssd, what’s the smoothest way to get going? I have to format the drive get NixOS on and have it run my config files. I don’t know the strategy to have that happen automatically. Is there a way to curl my GitLab and have things unfold and build? I think part of my problem is that I haven’t done secrets with SOPS yet. Is that a necessary step?

Thanks

1 Comment
2024/11/22
03:14 UTC

2

Install libstdc++-12-dev, not on nixpkgs

Hiya, I'm new to nixos (but not linux) so bear with me.

I want to work on a project using Flutter. But one of the dependencies is libstdc++-12-dev from this page, scroll to Development tools. This isn't on nixpkgs and so I've been struggling to work out the best way to install this properly. It's in the Debian repo, so I'm sure I could make something work but it's not very reproducible.

What's the nix-y way of doing this?

2 Comments
2024/11/21
23:27 UTC

0

Can I use nix to turn off all rgb in motherboard?

Hey, I can't seem to keep my rgb off from the BIOS settings on pretty much any motherboard I had. It turns off, but then keeps coming back after a while. So, I wondered if I can use NixOS to turn it off in a declarative way.
Anyone knows of a way to do that?

Thanks!

5 Comments
2024/11/21
23:12 UTC

4

Dolphin Image Previews

Anyone know why dolphin won't show any image previews? I've tried installing some dependencies along with it like this:
libsForQt5.dolphin

libsForQt5.kdegraphics-thumbnailers

libsForQt5.qtimageformats

libsForQt5.ffmpegthumbs

But still can't seem to make it work. All packages listed are installed with home manager via home.packages. I'm running hyprland on wayland as well.

0 Comments
2024/11/21
21:11 UTC

2

Hey! Has anyone got vr running on nixos?

Recently I had to kill my windows partition to run my two ssd on raid.

I'm happier using Linux and only really had windows for my oculus link games. I would prefer to completely discard windows and cut cubes on Linux.

I saw that there are some packages and wine wrappers around for arch, but before throwing myself into this I wanted to ask if anyone has experience with this could offer some guidance.

Thanks in advance!

3 Comments
2024/11/21
16:42 UTC

1

Using a fix branch in a shell?

I've got a simple shell:

with (import <nixpkgs> {});
mkShell {
    buildInputs = [
      python312
      pdm
      mariadb
    ];
  }

The pdm package depends on this python package python312Packages.dnspython that is currently broken. I've found someone already created a fix for it here: https://github.com/NixOS/nixpkgs/pull/357254

Is there a simple way to get that branched version of nix packages available in this shell?

6 Comments
2024/11/21
16:18 UTC

41

NixOS Basic Guide

Hey folks! Just wanted to share with you all a kind of guide I put together for anyone looking to get started with NixOS.

I've included all the essential commands, some real-world examples, and what's generally considered best practices.

Just a heads up - this guide is pretty basic and doesn't dive too deep into some of the cool stuff you might want to know about later. It's mostly based on my own experience playing around with NixOS and what I've picked up from the docs.

Feel free to drop any questions or suggestions in the comments - I'm totally down to help out!

Cheers!

NixOS Guide

6 Comments
2024/11/21
14:57 UTC

2

How do I use a random flake I found on the internet (nixpak specifically)?

Hi, I just installed nixos yesterday and moved the system to flakes. I'd like to use nixpak: https://github.com/nixpak/nixpak

The README provides an example flake, do I have to somehow run that separately, or do I have to integrate that with my existing flake? What I'm trying to ask is, whenever someone packages something using flake.nix (but it isn't in the nixpkgs repo), what is the standard way to install it?

3 Comments
2024/11/21
14:40 UTC

1

NixOS on macOS - Nix not picking up programs.fish.enable = True from home-manager?

I have a macOS machine that has Nix setup, using this Nix configuration template. (Uses home-manager, nix-darwin etc.)

Recently, when I've tried running nix flake update, then nix run ./#build-switch, I get the following error:

❯ nix run ./#build-switch
warning: Git tree '/Users/foobar/nixos-config' is dirty
Running build-switch for aarch64-darwin
Starting build...
warning: Git tree '/Users/foobar/nixos-config' is dirty
error:
       … while evaluating the attribute 'value'
         at /nix/store/c9wv7i0af6mysmy65x6nvyfw5izzxv4g-source/lib/modules.nix:816:9:
          815|     in warnDeprecation opt //
          816|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          817|         inherit (res.defsFinal') highestPrio;


       … while calling the 'addErrorContext' builtin
         at /nix/store/c9wv7i0af6mysmy65x6nvyfw5izzxv4g-source/lib/modules.nix:816:17:
          815|     in warnDeprecation opt //
          816|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |                 ^
          817|         inherit (res.defsFinal') highestPrio;


       (stack trace truncated; use '--show-trace' to show the full trace)


       error:
       Failed assertions:
       - users.users.foobar.shell is set to fish, but
       programs.fish.enable is not true. This will cause the fish
       shell to lack the basic Nix directories in its PATH and might make
       logging in as that user impossible. You can fix it with:
       programs.fish.enable = true;


       If you know what you're doing and you are fine with the behavior,
       set users.users.foobar.ignoreShellProgramCheck = true;
       instead.


nixos-config on  main [!?] took 10s 

In the modules/shared/home-manager.nix configuration, I do have:

  fish = {
    enable = true;

However, from Googling, I found this issue, which seems to suggest that Nix isn't aware of the home-manager module, and won't pick that up.

The weird thing is - this error only seems to have popped up recently, and secondly, I'm not entirely sure how NixOS even knows that fish is my shell?

I've set it using `chsh -s` - however, even if I change my shell back to `/bin/zsh` - and confirm that it's set to zsh:

nixos-config on  main [!?] 
❯ echo $SHELL
/bin/zsh

Nix still gives me the error message about the fish shell.

Also, I've tried adding the `users.users.foobar.ignoreShellProgramCheck = true;` statement in say, my flake.nix file and it keeps giving me errors like "unsupported attribute users" etc.

❯ cat flake.nix 
{
  description = "Starter Configuration for MacOS and NixOS";


  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    home-manager.url = "github:nix-community/home-manager";
    darwin = {
      url = "github:LnL7/nix-darwin/master";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    nix-homebrew = {
      url = "github:zhaofengli-wip/nix-homebrew";
    };
    homebrew-bundle = {
      url = "github:homebrew/homebrew-bundle";
      flake = false;
    };
    homebrew-core = {
      url = "github:homebrew/homebrew-core";
      flake = false;
    };
    homebrew-cask = {
      url = "github:homebrew/homebrew-cask";
      flake = false;
    };
    disko = {
      url = "github:nix-community/disko";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };


  outputs = { self, darwin, nix-homebrew, homebrew-bundle, homebrew-core, homebrew-cask, home-manager, nixpkgs, disko } u/inputs:
    let
      user = "foobar";
      linuxSystems = [ "x86_64-linux" "aarch64-linux" ];
      darwinSystems = [ "aarch64-darwin" "x86_64-darwin" ];
      forAllSystems = f: nixpkgs.lib.genAttrs (linuxSystems ++ darwinSystems) f;
      devShell = system: let pkgs = nixpkgs.legacyPackages.${system}; in {
        default = with pkgs; mkShell {
          nativeBuildInputs = with pkgs; [ bashInteractive git ];
          shellHook = with pkgs; ''
            export EDITOR=vim
          '';
        };
      };
      mkApp = scriptName: system: {
        type = "app";
        program = "${(nixpkgs.legacyPackages.${system}.writeScriptBin scriptName ''
          #!/usr/bin/env bash
          PATH=${nixpkgs.legacyPackages.${system}.git}/bin:$PATH
          echo "Running ${scriptName} for ${system}"
          exec ${self}/apps/${system}/${scriptName}
        '')}/bin/${scriptName}";
      };
      mkLinuxApps = system: {
        "apply" = mkApp "apply" system;
        "build-switch" = mkApp "build-switch" system;
        "copy-keys" = mkApp "copy-keys" system;
        "create-keys" = mkApp "create-keys" system;
        "check-keys" = mkApp "check-keys" system;
        "install" = mkApp "install" system;
      };
      mkDarwinApps = system: {
        "apply" = mkApp "apply" system;
        "build" = mkApp "build" system;
        "build-switch" = mkApp "build-switch" system;
        "copy-keys" = mkApp "copy-keys" system;
        "create-keys" = mkApp "create-keys" system;
        "check-keys" = mkApp "check-keys" system;
        "rollback" = mkApp "rollback" system;
      };
    in
    {
      devShells = forAllSystems devShell;
      apps = nixpkgs.lib.genAttrs linuxSystems mkLinuxApps // nixpkgs.lib.genAttrs darwinSystems mkDarwinApps;


      darwinConfigurations = nixpkgs.lib.genAttrs darwinSystems (system: let
        user = "foobar";
      in
        darwin.lib.darwinSystem {
          inherit system;
          specialArgs = inputs;
          modules = [
            home-manager.darwinModules.home-manager
            nix-homebrew.darwinModules.nix-homebrew
            {
              nix-homebrew = {
                inherit user;
                enable = true;
                taps = {
                  "homebrew/homebrew-core" = homebrew-core;
                  "homebrew/homebrew-cask" = homebrew-cask;
                  "homebrew/homebrew-bundle" = homebrew-bundle;
                };
                mutableTaps = false;
                autoMigrate = true;
              };
            }
            ./hosts/darwin
          ];
        }
      );


      nixosConfigurations = nixpkgs.lib.genAttrs linuxSystems (system: nixpkgs.lib.nixosSystem {
        inherit system;
        specialArgs = inputs;
        modules = [
          disko.nixosModules.disko
          home-manager.nixosModules.home-manager {
            home-manager = {
              useGlobalPkgs = true;
              useUserPackages = true;
              users.${user} = import ./modules/nixos/home-manager.nix;
            };
          }
          ./hosts/nixos
        ];
     });
  };
  users.users.foobar.ignoreShellProgramCheck = true;
}

Does anybody know why it's picking up the fish shell as my default shell? And how I might fix this via the flake.nix file, or elsewhere?

4 Comments
2024/11/21
14:02 UTC

3

how do i package an electron app?

I am trying to package oblivion-desktop as i couldn't find it on nixpkgs(how tf it has 100k packages yet i found more apps on aur). I searched through google just what an avg dude would but couldnt find anything useful. Im good with nodejs and things but still a noob at nix.

2 Comments
2024/11/21
13:53 UTC

2

flake-utils tip

Wrapping everything in your outputs in a system set does not follow the schema!!

Here is how to avoid this issue. Build it in an overlay!

    {
      inputs = {
        nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
        flake-utils.url = "github:nixos/nixpkgs/nixpkgs-unstable";
      };
      outputs = { self, nixpkgs, flake-utils, ... }@inputs: let
        forEachSystem = flake-utils.lib.eachSystem flake-utils.lib.allSystems;
    
        APPNAME = "REPLACE_ME";
        appOverlay = final: prev: {
          # Im just doing a script, but you probably want to use
          # `prev.callPackage ./. { inherit APPNAME inputs; }`
          # to move your derivation into another file
          ${APPNAME} = prev.writeShellScriptBin "${APPNAME}" ''
            echo "Running '${APPNAME}'..."
          '';
        };
      in {
        overlays.default = appOverlay;
      } // (
        forEachSystem (system: let
          pkgs = import nixpkgs { inherit system; overlays = [ appOverlay ]; };
        in{
          packages = {
            default = pkgs.${APPNAME};
          };
        })
      );
    }

Edit: for the uninitiated

https://wiki.nixos.org/wiki/Flakes#Output_schema

packages.<system>.default

^ good

overlays.<system>.default

^ bad

4 Comments
2024/11/21
13:01 UTC

7

Limit cores used for building package

Hey!

Been using nixos for a while, pretty stable and good, but I have problems regarding when I do let’s say:

nix-shell -I nixpkgs=channel:nixos-unstable -p zed-editor

My PC uses all of 20 cores possible and my computer freeze on building rust package, it comes back but takes a while, I tried to limit build cores with

NIX_BUILD_CORES=16 nix-shell -I nixpkgs=channel:nixos-unstable -p zed-editor

But it didn’t help, any idea?

Thanks.

Operating System: NixOS 24.05
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.2
Kernel Version: 6.6.61 (64-bit)
Graphics Platform: Wayland
Processors: 20 × 13th Gen Intel® Core™ i7-13650HX
Memory: 31.0 GiB of RAM
Graphics Processor: Mesa Intel® Graphics / NVidia 4070

6 Comments
2024/11/21
05:27 UTC

8

Haven't installed but curious

I've been keeping an eye on this distro and I'm curious about it. How hard is it to correctly use nixos? Things I currently (hopefully)understand.

It's atomic.

It relies solely on nix packages which are containerized packages (I think?)

When you update a package it doesn't erase the old one which makes it useable if you need to rollback.

Things I don't understand.

Everything else 😂.

But one of the questions I do have is, if the old package isn't removed, after some time of updating, wouldn't that eventually clog up system space? How do you remove an older package?

14 Comments
2024/11/21
04:12 UTC

2

Help getting nvchadui plugin working with base46

https://github.com/sjhaleprogrammer/nixos here is my config i have two files neovim.nix and neovim.lua

mission impossible: install base46

0 Comments
2024/11/21
03:50 UTC

1

Jetbrains Rider 2024.3 unable to open solutions

I am on the unstable branch and just recently updated my entire system flake from configs to home-manager. Everything went smoothly except Rider now wont open solutions. When launching Rider it opens the project explorer where you select which solution to open, but when I pick a solution to open it only momentarily closes the project explorer but doesn't launch the IDE and immediately returns to the project explorer window.

Anybody else experiencing the same issue?

OS: NixOS 25.05.20241119.23e89b7 (Warbler) x86_64
Kernel: Linux 6.12.0
DE: GNOME 47.1
3 Comments
2024/11/21
03:01 UTC

17

How do you decide where to add a NixOS package in the configuration?

When you often use a software and decide to install it, what questions do you ask yourself to decide where to put the package between the following?

  • environment.systemPackages
  • users.users.<name>.packages
  • home.packages

Let’s take into consideration only software you call directly (no window managers, bars, etc) and ignore those enabled through .enable = true.

For example, if you find yourself often running VLC and finally decide to install it, where in your configuration will you add it?

Edit: changed * to <name>.

11 Comments
2024/11/21
00:50 UTC

2

After collecting garbage, stack tried to find libgmp then failed even with no dependencies at all

I use nix-darwin and have enabled nix in ~/.stack/config.yaml. Earlier today I did a sudo nix-collect-garbage -d then many things begin to break.

Minimum reproducible example:

stack new mwe
cd mwe
stack build
mwe> configure (lib + exe)
dyld[39413]: Library not loaded: /nix/store/lac8fhiz0pmif1bmrkkry3w4slc9wg47-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib
  Referenced from: <0F2264AA-4505-36E1-A379-2BC393A601C5> /Users/futar/.stack/setup-exe-cache/aarch64-osx-nix/Cabal-simple_CKvAmRb3_3.10.3.0_ghc-9.6.6
  Reason: tried: '/nix/store/lac8fhiz0pmif1bmrkkry3w4slc9wg47-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/nix/store/lac8fhiz0pmif1bmrkkry3w4slc9wg47-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib' (no such file), '/nix/store/lac8fhiz0pmif1bmrkkry3w4slc9wg47-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib' (no such file), '/usr/local/lib/libgmp.10.dylib' (no such file), '/usr/lib/libgmp.10.dylib' (no such file, not in dyld cache)

Error: [S-7282]
       Stack failed to execute the build plan.

       While executing the build plan, Stack encountered the error:

       [S-7011]
       While building package mwe-0.1.0.0 (scroll up to its section to see the error) using:
       ...
       Process exited with code: ExitFailure (-6)

A problem that I have never seen before this garbage collection.

Adding gmp as a nix package in stack.yaml does not help and result in the same error message. Neither would nix-shell -p gmp do any better.

nix:
  enable: true
  packages:
    - gmp

I do have gmp-with-cxx here. Why can't stack find it? Why a wrong hash was used?

% ls /nix/store/*-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib
/nix/store/lm1rva8c2649y4lys3d406s9ldicv8qv-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib

Thanks for any help in advance.

4 Comments
2024/11/21
00:18 UTC

5

Anyone have an answer for this?

Got this today when doing an update:

Alias neovim is still in node-packages.nix

Running unstable .. nothing has changed since last time on my system. Is something broken with nodejs?

All help appreciated :)

1 Comment
2024/11/20
23:59 UTC

2

Font size way too large with hidpi

Hello, I’ve set GDK_SCALE and GDK_DPI_SCALE to 2, but *UI* font sizes in GTK apps are way too big, easily 3x as big as they should be on my screen. Other fonts, when I request a certain size, like 12, are exactly as they should be. Any ideas what I should check to fix this problem?

It feels like my UI font sizes are close to 20 or 30 rather than the 13 or 14 I’d normally expect.

6 Comments
2024/11/20
18:35 UTC

2

Best approach to keyboard remap?

I purchased a keyboard without realizing it had a Mac layout, which has a different bottom row and has a sleep button on the location of the supr key.

Is it possible to remap the keycodes on a DE-agnostic way, ideally through the NixOs config? I'm able to do some swaps through KDE's config, but the changes are not carried on to vms (or other software that uses keycodes directly) and to the display manager... not to mention that the config is lost when I switch to a different DE

11 Comments
2024/11/20
16:05 UTC

0

Cant Create Hotspot

My wireless wifi adapter works well on windows with wifi on and hotspot on at the same time and am also able to use it to capture wpa handshakes with aircrack-ng here on nixos meaning it supports monitor mode and thus this is less likely to be an issue with my wifi adapter.

When I try to set it up on nixos it detects all available networks but am unable to connect to wifi. The hotspot is on though and when I connect to lan the hotspot has internet access but it recursively disconnects and reconnects again after every like 2 minutes.

I just want the wifi adapter to act as both the internet interface and ap interface

When I run wihotspot through terminal I get this error

wihotspot

(wihotspot:56014): Gtk-WARNING **: 16:29:03.704: Could not load a pixbuf from /org/gtk/libgtk/theme/Adwaita/assets/bullet-symbolic.svg.
This may indicate that pixbuf loaders or the mime database could not be found.
Couldn't open config file for reading.
pkexec --user root create_ap wlp4s0 enp0s31f6 'biiitch' '' --mkconfig /etc/create_ap.conf 
Config options written to '/etc/create_ap.conf'

Error: Failed to run hostapd, maybe a program is interfering.
If an error like 'n80211: Could not configure driver mode' was thrown
try running the following before starting create_ap:
    nmcli r wifi off
    rfkill unblock wlan
Command not found or exited with error status
pkexec --user root create_ap wlp4s0 enp0s31f6 'biiitch' '' --mkconfig /etc/create_ap.conf 
Config options written to '/etc/create_ap.conf'
RTNETLINK answers: Device or resource busy

ERROR: Maybe your WiFi adapter does not fully support virtual interfaces.
       Try again with --no-virt.

Command not found or exited with error status

This is my hotspot.nix

{ pkgs, ... }:
{
  services.create_ap = {
    enable = true;
    settings = {
      INTERNET_IFACE = "wlp4s0";
      WIFI_IFACE = "wlp4s0";
      SSID = "biiitch";
      PASSPHRASE = "calculAss";
    };
  };
  
  environment.systemPackages = with pkgs; [
    hostapd
  ];
}

This is my networking.nix

{
  config,
  pkgs,
  host,
  options,
  ...
}: {
  networking = {
    networkmanager = {
      enable = true;
      #dns = "dnsmasq";
    };

    hostName = "${host}";
    hosts = {
      # "127.0.0.2" = ["other-localhost"];
      # "192.0.2.1" = ["mail.example.com" "imap.example.com"];
      "10.10.125.64" = ["cyprusbank.thm" "admin.cyprusbank.thm"];
    };

    timeServers = options.networking.timeServers.default ++ ["pool.ntp.org"];
    nameservers = ["8.8.8.8" "8.8.4.4"];

    nftables = {
      enable = true;
      ruleset = ''
        table ip nat {
            chain PREROUTING {
                type nat hook prerouting priority dstnat; policy accept;
                iifname "ens3" tcp dport 80 dnat to 10.100.0.3:80
            }
        }
      '';
    };

    firewall = {
      enable = false;
      allowedTCPPorts = [ ];
      allowedUDPPorts = [ ];
    };

    nat = {
      enable = true;

      internalInterfaces = ["waydroid0" "docker0"];
      externalInterface = "wlp4s0";

      internalIPs = ["192.168.240.0/24"];
      # externalIP = "Your IP";

      /*
         forwardPorts = [
        {
            sourcePort = 80;
            proto = "tcp";
            destination = "10.100.0.3:80";
        }
      ];
      */
    };
  };

  # services.dnsmasq.enable = true;

  /*
     services.create_ap = {
      enable = true;
      settings = {
          INTERNET_IFACE = "eth0";
          WIFI_IFACE = "wlan0";
          SSID = "biiitch";
          PASSPHRASE = "calculAss";
       };
  };
  */

  environment.systemPackages = with pkgs; [
    openvpn
    # dnsmasq
    # hostapd
    # linux-wifi-hotspot
  ];
}

For some reason nm-applet seems to detect two new interfaces instead of one

https://preview.redd.it/b0k4ga4pd22e1.png?width=1920&format=png&auto=webp&s=d1effea860c511f0249f86450873aab64ed0b049

ifconfig
ap0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.12.1  netmask 255.255.255.0  broadcast 192.168.12.255
        inet6 fe80::16ab:c5ff:fe7f:2b1a  prefixlen 64  scopeid 0x20<link>
        ether 14:ab:c5:7f:2b:1a  txqueuelen 1000  (Ethernet)
        RX packets 10786  bytes 1723529 (1.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13003  bytes 15184797 (14.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:5c:cb:92:3d  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 2 overruns 0  carrier 0  collisions 0

enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.99.121  netmask 255.255.255.0  broadcast 192.168.99.255
        inet6 fe80::b93:3e07:ec36:a0bf  prefixlen 64  scopeid 0x20<link>
        ether c8:5b:76:ab:2f:35  txqueuelen 1000  (Ethernet)
        RX packets 21999  bytes 19616663 (18.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 21340  bytes 8721508 (8.3 MiB)
        TX errors 0  dropped 3 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xf1300000-f1320000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp4s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 46:57:9b:7d:e2:f9  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
1 Comment
2024/11/20
14:11 UTC

0

Should I switch to NixOS btw?

I have used Arch for more than a year and am currently using Fedora due to personal reasons. For me, only Fedora and Arch are feasible options. I have been looking into NixOS for quite some time now and find it quite interesting.

The main reasons I want to use NixOS are, first, the availability of packages, which can sometimes be lacking in Fedora, and second, the reproducible NixOS generations that allow me to roll back to a previous version if a recent update breaks something.

While trying out NixOS in a VM, I encountered some issues that prevent me from using it as my daily driver. The first was setting up Python with a requirements.txt file, which I managed to fix using nix-ld. The second issue is the unavailability of a Docker Desktop app. I understand that Nix is all about reproducibility, but tech companies rely heavily on Docker. If I can’t use Docker Desktop smoothly, it might cause problems.

Should I forget about NixOS, or is there still hope?

15 Comments
2024/11/20
13:54 UTC

2

Force NixOS to compile packages

How can I force NixOS to compile all packages on rebuild instead of downloading them from the binary cache?

7 Comments
2024/11/20
10:22 UTC

8

Migrating from Proxmox

I want to migrate from Proxmox to NixOS

For the last year I used TrueNas, but it bothered me that even when using docker, I could only use the web ui or dockge/portainer to manage my services. So I decided to plunge into Proxmox. 

Yet I can’t figure out the jungle of install scripts and permissions to run stuff like Immich. Especially since I don’t really need VMs (plus I couldn’t even get an Ubuntu one to run for some reason)

So instead of manually creating lxc containers for all my services I want a docker install that just works (especially GPU pass through for ollama, jellyfin, etc).

NixOS is appealing because of the simple rollback function and the declarative and atomic nature. 

This ties into my biggest problem: I use my server for data science/ coding work. Even though I don’t have any active workloads running 24/7 I can’t go without for too long. I also don’t have any other machine to test NixOS on. (Since I can’t even get a normal Ubuntu VM to run I didn’t bother trying NixOS with the storage setup I would need to test)

My desired setup is:
- a Raid 10 zfs array of 6 ssds 
- a Raid 10 zfs array of 6 HDD
- NVIDIA 4060 pass through to docker
- services using docker, traefik, pihole and Tailscale 

The zfs array are currently running like this on the Proxmox host.

Main Questions:
- How long approximately does a setup like this take for a beginner (only to get it working, I know that configuring a server is a continuous process)
- What guides and tutorials can you recommend 

Additionally, any advice on how to migrate the data is highly appreciated.

12 Comments
2024/11/20
02:56 UTC

1

Journal logs spammed with CTRL-EVENT-SCAN-FAILED

I'm not sure when it started, but I'm being constantly bombarded with

wpa_supplicant[1917]: wlp4s0: CTRL-EVENT-SCAN-FAILED ret=-22

In my journal logs. Which has accumulated to 38761 lines and counting.

I currently use an AX200:

04:00.0 Network controller: Intel Corporation Wi-Fi 6 AX200 (rev 1a)
Subsystem: Intel Corporation Wi-Fi 6 AX200NGW
Kernel driver in use: iwlwifi
Kernel modules: iwlwifi

And I haven't touched my network config from the NixOS defaults beyond manually enabling networkmanager (though the GNOME config already sets that, wpa_supplicant is used as the backend) and using dnscrypt with the wiki recommended setup (disabling it makes no difference).

The error "seems" harmless, because I can still view, connect and interact with networks just fine from the GNOME settings panel, so my guess its that it is related to active scanning, like the one mentioned in:

NetworkManager[151159]: <warn>  [1732054149.8691] device (wlp4s0): wifi-scan: active scanning for networks due to profiles with wifi.hidden=yes. This makes you trackable

Though I've never enabled that explicitly.

I haven't been able to find this exact issue while searching for the error it prints out. Does anyone have pointers that might help in diagnosing this?

0 Comments
2024/11/19
22:41 UTC

Back To Top