/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

32,635 Subscribers

0

issue with ameziawg

after installing amneziawg kernel module and amneziawg tools i tried to enable systemd service with start command, but it didn't found any services. I cannot find any ways to enable amenzia. May someone give me a guide? What did i do wrong?

1 Comment
2024/12/20
15:45 UTC

0

Why does my nvidia.nix doesn't boot in any display manager like lightdm,sddm or gdm?

it used to work in nixOs stable, but I fresh installed the entire Os with a unstable version(25.05).

I have a 920MX GPU ( 920M is 470.xx so I think 920MX is too )

Every time I apply nvidia default.nix, I can't boot display-manager and two Core dump info are showed.

i did not used anything commented in nvidia default.nix in this build.

{ pkgs, config, libs, ... }:

{
  nixpkgs.config.nvidia.acceptLicense = true;

  #boot.initrd.kernelModules = [ "nvidia" ];
  #boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];

  # Enable OpenGL
  hardware.graphics.enable = true;
  hardware.graphics.enable32Bit = true;
  # Load nvidia driver for Xorg and Wayland
  services.xserver.videoDrivers = [ "nvidia" "modesetting" ];
  #  services.xserver.videoDrivers = ["nvidiaLegacy470" "modesetting" ];
  #  services.xserver.videoDrivers = ["nvidia"];
  #  hardware.bumblebee.enable = true;
  hardware.nvidia = {

    modesetting.enable = true;

    powerManagement.enable = false;   
 
    powerManagement.finegrained = false;
    open = false;

    nvidiaSettings = true;

    package = config.boot.kernelPackages.nvidiaPackages.legacy_470;
    prime = {
      sync.enable = true;
      intelBusId = "PCI:0:2:0";
      nvidiaBusId = "PCI:1:0:0";
    };
  };
}

$ sudo lshw -c display

*-display                 
       product: i915drmfb
       physical id: 2
       bus info: pci@0000:00:02.0
       logical name: /dev/fb0
       version: 02
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm bus_master cap_list rom fb
       configuration: depth=32 driver=i915 latency=0 resolution=1920,1080
       resources: irq:135 memory:ed000000-edffffff memory:c0000000-cfffffff ioport:f000(size=64) memory:c0000-dffff
  *-display
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a2
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list rom
       configuration: driver=nouveau latency=0
       resources: irq:136 memory:ee000000-eeffffff memory:d0000000-dfffffff memory:e0000000-e1ffffff ioport:e000(size=128) memory:ef000000-ef07ffff

x11.nix

{ config, lib, pkgs, ... }:
{
  services = {
# displayManager.sddm.enable = true;
    displayManager.defaultSession = "none+awesome";
    xserver = {
      xkb = {
        layout = "us";
        #variant = "alt-intl";
      };
      enable = true;
      displayManager = {
        lightdm.enable = true;
      };      
      windowManager.awesome = {
        enable = true;
        luaModules = with pkgs.luaPackages; [ luarocks luadbi-mysql ];
      };
    };
  };
}

keyring

{ config, lib, pkgs, ... }:

{
  programs.seahorse.enable = true; # Keyring program
  services.gnome = {
    gnome-settings-daemon.enable = true;
    gnome-keyring.enable = true;
  };

  systemd = {
    user.services.polkit-gnome-authentication-agent-1 = {
      description = "polkit-gnome-authentication-agent-1";
      wantedBy = [ "graphical-session.target" ];
      wants = [ "graphical-session.target" ];
      after = [ "graphical-session.target" ];
      serviceConfig = {
        Type = "simple";
        ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
        Restart = "on-failure";
        RestartSec = 1;
        TimeoutStopSec = 10;
      };
    };
  };

  security.pam.services.lightdm.enableGnomeKeyring = true;

  security.polkit.extraConfig = ''
    polkit.addRule(function(action, subject) {
      if (
        subject.isInGroup("users")
          && (
            action.id == "org.freedesktop.login1.reboot" ||
            action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
            action.id == "org.freedesktop.login1.power-off" ||
            action.id == "org.freedesktop.login1.power-off-multiple-sessions"
          )
        )
      {
        return polkit.Result.YES;
      }
    });
  '';
}

I already tried to clean nixOs with

$ sudo nix-collect-garbage -d

$ nix-collect-garbage

$ nix-store --gc

$ nix-store --optimise

and applying the configuration again but no luck yet

2 Comments
2024/12/20
15:34 UTC

0

How to configure session files for sddm?

I have two uwsm-managed hyprland desktop files. But the one which sddm points to is not recommended by the official repo and the one that SDDM uses now is quite buggy. This is what SDDM points to:

[Desktop Entry]
Name=Hyprland (UWSM)
Comment=Hyprland compositor managed by UWSM
Exec=/nix/store/aiszcvhvisyv7ik6c0idbgkvxfh1qhjn-uwsm-0.20.5/bin/uwsm start -S -F /run/current-system/sw/bin/Hyprland
Type=Application

and this is what I want it to look like, provided by the Hyprland repo:

[Desktop Entry]
Name=Hyprland (uwsm-managed)
Comment=An intelligent dynamic tiling Wayland compositor
Exec=uwsm start -- hyprland.desktop
DesktopNames=Hyprland
Type=Application

These is my nix-config.

Thanks.

5 Comments
2024/12/20
13:32 UTC

1

[Help] Will NixOS fit my needs?

Hello everyone, thank you for helping me, i’ll try to make this as quick as possible to not bother anyone.

I just bought a separate drive to run Linux (lately on windows i have way too many issues, i have experience for work on linux servers and unix systems).

While i want to keep the Windows drive to run Unreal Engine and the games that doesn’t work on Linux, i want to use the Linux drive for everything else (gaming, general programming) and NixOS seems a quite interesting distro. I have an NVidia 3080, amd cpu, and ideally i wouldn’t use a full DE but a QTile environment. Can i try running NixOS or it is better suited of other cases? Feel free to ask any information i might have forgotten to add!

Thank again everyone

16 Comments
2024/12/20
11:31 UTC

2

Distrobox Gnome

Am using hyprland. I have setup distrobox correctly and when I launch apps they render just correctly. However I havent been able to launch gnome. running gnome-session inside my container kills ags in my host hyprland and all other windows apart from wezterm. gnome-session does not return any error though.

I want to be able to launch the whole desktop environment as a window in hyprland . I dont know if thats possible though. If not how do I add this as a session to my login manager.

I must add that xserver is not enabled. I disabled it because for some reason apps like burpsuite and onlyoffice and even discord were not launching and everything worked fine after disabling it and enabling xwayland in my hyprland config

These are the errors am getting

gnome-shell

libmutter-Message: 11:02:33.841: Running GNOME Shell (using mutter 47.3) as a Wayland display server
Failed to setup: Could not take control: Cannot invoke method; proxy is for the well-known name org.freedesktop.login1 without an owner, and proxy was constructed with the G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START flag



gnome-shell --replace --wayland

libmutter-Message: 11:01:44.513: Running GNOME Shell (using mutter 47.3) as a Wayland display server
Failed to setup: Could not take control: Cannot invoke method; proxy is for the well-known name org.freedesktop.login1 without an owner, and proxy was constructed with the G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START flag




gnome-shell --replace --x11

libmutter-Message: 11:01:06.293: Running GNOME Shell (using mutter 47.3) as a X11 window and compositing manager
Xlib:  extension "DPMS" missing on display ":0".
Xlib:  extension "DPMS" missing on display ":0".

(gnome-shell:213692): Mtk-ERROR **: 11:01:06.498: Received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
  (Details: serial 218 error_code 10 request_code 2 (core protocol) minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the MUTTER_SYNC environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the mtk_x_error() function.)
== Stack trace for context 0x55ff592c7c70 ==
Trace/breakpoint trap (core dumped)
6 Comments
2024/12/20
10:56 UTC

3

I am facing issues when migrating my nixos to flakes

Hi fellas

I am trying to migrate my nixos config into using flakes, but when doing it I am facing this error

command: sudo nixos-rebuild switch --flake .#nixos --show-trace

       … while calling the 'import' builtin
         at /nix/store/y1rag06xdixlpmf68s03f8raw9y7glkn-source/lib/modules.nix:361:99:
          360|           throw "Module imports can't be nested lists. Perhaps you meant to remove one level of lists? Definitions: ${showDefs defs}"
          361|         else unifyModuleSyntax (toString m) (toString m) (applyModuleArgsIfFunction (toString m) (import m) args);
             |                                                                                                   ^
          362|

       error: path '/nix/store/iz2ramddrhkzamlsmaxhk561s3a3r46i-source/nixos/configuration.nix' does not exist

here's the config repo: https://github.com/aryuuu/nixos

the content of nixos/ dir in that repo is copied directly from /etc/nixos

does anyone know what might be causing this issue and how to fix it?

Thank you in advance

update: looks like it is working now after i committed all the files in the repo

4 Comments
2024/12/20
04:04 UTC

3

Finally got wezterm set up with a decent config through home-manager with Stylix integration. That was anything but straight forward.

Felt great on that final compile seeing the color pallets generated and no errors. Boom 💥 haha

7 Comments
2024/12/20
00:34 UTC

3

LycheeSlicer AppImage error

Heyho,
so I'm trying to run the Lycheeslicer.AppImage... all the versions basically run into the same issue. I updated my system today (had another error before) and now I'm stuck. (rollback to the before won't help - the other issue sucks as well)
so I just run appimage-run Lychee....AppImage but get an error that libxshmfence is missing. Well I'm on wayland, so I suppose that's to be expected. It runs on my Arch device (wayland as well) without issues.

/home/myname/.cache/appimage-run/f2cf893f95fbeb0b36a1c63b0b292e9f437655e92bf0b489d0033257e3ccd381/lycheeslicer: error while loading shared libraries: libxshmfence.so.1: cannot open shared object file: No such file or directory

thats what I get... adding the lib to the shell.nix does not help. Any hints?
Thanks

UPDATE 20.12.

So, after tinkering a while and updating my system I now am missing libxshmfence.so.1.

That apparently is missing from the AppImage so it apparenlty searches for it in my system and well.. won't find anything in /usr/lib of cause. And I'm not sure how to tell him where to look

2 Comments
2024/12/19
20:35 UTC

0

Writing NixOS Configurations in TypeScript?

Is it possible to write NixOS configurations in TypeScript? Are there any tools or libraries that support this, or is anyone working on it? Looking for ways to integrate TypeScript into the NixOS workflow.

Thanks!

3 Comments
2024/12/19
20:12 UTC

2

Stylix installation WITHOUT flakes

anyone got a way to install stylix WITHOUT flakes ? i am running Home-Manager as a module

1 Comment
2024/12/19
20:11 UTC

5

I use NixOS, but I barely touch the system config and just use home-manager whenever possible. Is there a point in using NixOS over Nix and HM on any other distro?

5 Comments
2024/12/19
20:02 UTC

5

NixOS plasma6 ISO doesn't work

I finally decided to run NixOS on my PC and wanted to go with the plasma 6 DE. when booting and going through the installer I was left with the only the terminal even though the directory Desktop was made. Tried everything, and using lspci -k | grep -EA3 'VGA|3D|Display' showed the kerner driver in use was amdgpu (which is correct). tried a bunch of different configuration changes which didnt work either. i tried adding `services.xserver.videoDrivers = [ "amdgpu" ];` in my configuration as well.

once i gave up on i and retried it with the GNOME iso, chose the GNOME DE during the installer, and everything worked flawlessly. I'd like to know if anyone else ran into this and/or if this is a known issue to the developers.

1 Comment
2024/12/19
16:40 UTC

4

GRUB not working

I recently replaced systemd-boot with GRUB. Every time I use nixos-rebuild switch, it clearly says "Installed GRUB 2.0 to /boot/EFI". When I reboot/turn on my laptop, I still see systemd interface. What am I doing wrong?

11 Comments
2024/12/19
13:26 UTC

1

Zscaler client on nix

0 Comments
2024/12/19
12:56 UTC

6

How does the flake.nix know what host configuration to use?

I'm very new to NixOS, having switched from Arch. I've been following the "NixOS & Flakes Book: An Unofficial Book for Beginners." In the example configuration provided here: https://github.com/ryan4yin/nix-config/blob/i3-kickstarter/flake.nix, I see how two host PCs and two users are created. However, I can't wrap my head around how the flake determines which configuration to use. I'm also unsure how useing this method you could assign the same user to both PCs or use multiple users per PC.

Sorry if this is super obvious i have looked around already and i cant find anything that directly discusses it.

14 Comments
2024/12/19
09:09 UTC

1

nixos-rebuild: error: … while calling the 'head' builtin

[RESOLVED]

I had a module import, and it must have switched to demanding flakes without checking if it's enabled:

cat /etc/nixos/nix-alien.nix

{ ... }:

let

nix-alien-pkgs = import (

builtins.fetchTarball "https://github.com/thiagokokada/nix-alien/tarball/master"

) { };

in

{

environment.systemPackages = with nix-alien-pkgs; [

nix-alien

];

# Optional, but this is needed for `nix-alien-ld` command

programs.nix-ld.enable = true;

}

And NixOS didn't tell me that the error was in this line in the config file or in that specific module. At least not in a way I could parse. Try and error.

Thanks to anyone who tried to help.

-----------------------

I can't rebuild my system. This here is the output. I can't find any option or program which it might be referring to. The full stack also doesn't help. Nothing about flake is in the configuration.nix file.

sudo nix-env -p /nix/var/nix/profiles/system --delete-generations +3 && sudo nixos-rebuild switc
h --upgrade
[sudo] password for user:  
unpacking channels...
building Nix...
building the system configuration...
error:
… while calling the 'head' builtin

at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:1575:11:

1574|         || pred here (elemAt values 1) (head values) then
1575|           head values
|           ^
1576|         else

… while evaluating the attribute 'value'

at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:809:9:

808|     in warnDeprecation opt //
809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
|         ^
810|         inherit (res.defsFinal') highestPrio;

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

error: experimental Nix feature 'flakes' is disabled; use '--extra-experimental-features flakes' to override

9 Comments
2024/12/19
05:22 UTC

1

Cannot run .NET 6 project in a nix-shell

I got assigned a ticket to update a legacy .NET 6 API, since most of our projects are .NET 8 and up I needed to use a nix-shell with the following flake:

{
  description = ".NET 6 Dev Shell";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
  };

  outputs = { self, nixpkgs }:
  let
    system = "x86_64-linux";
    pkgs = import nixpkgs {
      inherit system;
      config = {
        permittedInsecurePackages = [ "dotnet-sdk-6.0.428" ];
      };
    };
  in
  {
    devShells.${system}.default = pkgs.mkShell {

      packages = with pkgs; [
        dotnet-sdk_6 
      ];

      DOTNET_ROOT = "${pkgs.dotnet-sdk_6}";

      shellHook = ''
        exec fish
      '';
    };
  };
}

It a pretty straight forward shell that adds the dotnet-sdk_6 package as dependency and update the DOTNET_ROOT environment variable and use fish shell. The nix-shell works as expected (installing the dotnet-sdk_6 package, updating the environment variables, and using fish shell), but when I'm in the shell I cannot run the project from the Rider IDE and get the following error:

Running the .NET 6 API fails

However, this is not an issue when I run any .NET 8 projects without nix-shell, for example:

Running the .NET 8 API succeeds

I am not sure what is wrong if there is anything in the flake.nix of the nix-shell that needs to be changed. Any guidance or suggestions that point me in the right direction will be appreciated because as it is I simply cannot work on legacy projects until this issue is address. Thank you so much Nix fam, happy holidays to everyone.

9 Comments
2024/12/19
03:23 UTC

1

Help creating a multi-systems flake for dev environments

Hello! I have a flake that defines dev environments like:

devShells.aarch64-darwin = {
  go = pkgs.mkShell {
    packages = with pkgs; [air go_1_23 gopls gofumpt];
  }
}

Now, I'd like to be able to use it in my linux server as well. Can I get the flake to recognize what system am I using? Any other alternatives?

3 Comments
2024/12/19
03:16 UTC

1

How to correctly use `inputs.<>.follows`?

Context: anyrun

While using the Anyrun flake, overriding the nixpkgs input for Anyrun will cause cache hits, i.e., you will have to build from source every time. To use the cache, do not override the Nixpkgs input.

  • Can someone explain whats happening behind the scenes?
  • Does this mean that defining the follows property is a bad practice?
  • I currently manually check inputs of a foreign flake- and add follows prop to all the flakes that I use in my system config? Should one not do this?
2 Comments
2024/12/19
02:49 UTC

11

LazyVim with Home Manager

is anyone running the LazyVim distro with Home Manager? i've seen a few threads suggesting to disable mason and it works fine but i'm struggling to get it to even install.

here's a snippet of my home.nix file:

programs.neovim = {
  enable = true;
  plugins = [
    pkgs.vimPlugins.LazyVim
  ];
};
        ```
13 Comments
2024/12/18
21:26 UTC

1

Gtk theme doesn't apply to most apps and I can't do the fix the nix way pls help

https://github.com/vinceliuice/WhiteSur-gtk-theme That's the theme it has a fix librewait section and is available as a nixpkgs but the nixpkgs doesn't really help at all . I don't know how I would do it the declarative nix way . Can anyone more knowledgeable help ?

8 Comments
2024/12/18
17:42 UTC

1

Can't boot with root on RAID

I am trying to install nixos to raid 1 array. I created, assembled and formatted the array using mdam, formatted as btrfs, created subvolumes, mounted and installed. No matter what I am trying, booting gets stuck on "A start job is runnign for /dev/md0" which eventually times out. I am completely lost... My hw configuration contains `boot.swraid.enable = true` and `boot.swraid.mdadmConf` where I specified "DEVICES <partition>" and "ARRAY" where I set the UUID, /dev/md0 and name for the array. Further in the file, I am mounting the fs like below. I am not able to c&p text from the computer as I can't connect to that computer remotely yet I will be thankful for anyone who could help me to get unstuck here. Thank you!

fileSystems."/" = {
    device = "/dev/md0";
    fsType = "btrfs";
    options = [ "subvol=@" "compress=zstd"];
  };

5 Comments
2024/12/18
16:02 UTC

8

Another one of my adventures. But now in completely unknown territory.

Hello everyone, I'm a Linux and technology enthusiast in general. In this new journey I'm going from Arch Linux to NiX OS (I haven't installed it yet)

The purpose of this adventure is to enter a world unknown to me, start from scratch and learn how things work little by little. I read that Nix is a very different distro with many possibilities.

I wanted to use it on a very modest and old machine (2013) Specifications: Lenovo IdeaPad Z580 Chip: Intel i7 3th 2.1ghz GPU: Intel gráfica 4000 + NVIDIA GeForce 630M Ssd: 480gb. Etc.

I would like to ask you to share your experiences on how and for what type of activity you use Nix OS.

NB: Thank you for the feedback and I believe that I will count on everyone's help in this magnificent journey that I intend to begin.

THANK YOU ALL AND GOD BLESS.

9 Comments
2024/12/18
15:06 UTC

1

Ignore unavailable inputs during build?

My flake depends on an input of kind "git+ssh" which is a private repository of mine. Now, this works nicely during my normal use.

Recently however, I wanted to give people the option of trying out my configuration and I have taken most of the steps necessary to provide a smooth experience, disabling private settings like sops and others for this 'public' configuration. However, one thing I cannot solve is that nixos-rebuild will always fail on an 'anonymous' host (where I do not have the proper ssh keys) with error: Cannot find git revision [...] - which is no surprise really, as the needed keys are not available. However, the configuration I am trying to build in this case does not at all depend on this input (the one that I mentioned above) - is there any way to exclude this input from this specific configuration or just skip over this error?

--keep-going is not enough it seems. I guess one way would be to define another flake for this configuration, but I would like to avoid that.

6 Comments
2024/12/18
14:51 UTC

Back To Top