1
1
submitted 1 year ago by gomp@lemmy.ml to c/nixos@lemmy.ml

I need to generate a number of scripts in my configuration and make them into a single package (for ease of reference, because there are a lot of them).

So far, I'm creating the scripts via writeShellApplication, making them into packages via an overlay, merging them with buildEnv and then adding the resulting package to `systemPackages.

Something like:

nixpkgs.overlays = [ (final: prev: {
  my-hello-1 = final.writeShellApplication {
    name = "my-hello-1-script";
    text = "echo my hello wolrd 1";
  };
  my-hello-2 = final.writeShellApplication {
    name = "my-hello-2-script";
    text = "echo my hello wolrd 1";
  };
  my-hello-scripts = final.buildEnv {
    name = "my-hello-scripts";
    paths = [ final.my-hello-1 final.my-hello-2 ];
  };
}) ];

environment.systemPackages = [ pkgs.my-hello-scripts ];

This works, but I don't really need the my-hello-1 and my-hello-2 packages... can you think of a way to make do without needing them?

2
1
submitted 1 year ago by gomp@lemmy.ml to c/nixos@lemmy.ml

I'm migrating my NAS to nixos, and I got to the point of setting up my restic backups.

services.restic.backups is great, but -- on top of the systemd timers/services -- I also want some helper scripts (eg. one to easily mount the backups, stuff that with ansible I currently generate into /usr/local/sbin).

These scripts would be entirely generated from the services.restic.backups config and would reference sops secrets also from configuration.nix, so... I don't think it would make sense to make a package out of them?

What should I use to make these scripts? Should I use nixpkgs.writeShellApplication and then alter the PATH?

3
1
submitted 1 year ago by hallettj@beehaw.org to c/nixos@lemmy.ml

I've been searching for a way to do this, but I haven't found anything. After I have refactored my Home Manager configuration is there a way I can test the changes in a shell before I switch?

From what I understand the next-best option is to switch, and then find and run the activate script of the previous generation to switch back.

4
1
submitted 1 year ago* (last edited 1 year ago) by theshatterstone54@feddit.uk to c/nixos@lemmy.ml

I was configuring DWM, among other things, for the last 3-4 days, and every single rebuild switch caused a new generation to appear. There were too many Systemd-boot entries so they couldn't even fit on the screen and continued down to Gen 41. It's just crazy.

Edit: This post: https://feddit.uk/post/1454174 shows the rest of the boot entries

5
1
submitted 1 year ago by SK4nda1@lemmy.ml to c/nixos@lemmy.ml

Im just starting out in my nixos journey. This thought came to me in the shower: would nixOS lend itself for a phone OS?

6
1
submitted 1 year ago* (last edited 1 year ago) by GravelPieceOfSword@lemmy.ca to c/nixos@lemmy.ml

I couldn't find a nix community, so I'm hoping it is ok that I'm posting on the nixos one instead. I'll switch to mailing list/discord if necessary, but I have a lemmy app on my phone, and it is much easier to have an ongoing conversation from here, so I decided to give it a shot. Here goes!

While I have a NixOS laptop, I primarily use other systems (e.g. OpenSuse Tumbleweed) as of now.

I love the ability to define the packages I want installed, with home-manager managing my command line utilities (e.g mtr, dig, protobuf etc).

I've been playing around a bit with protobuf recently, and after generating some c++ code using protoc, I loaded up the generated code in vscode, which understandably wasn't able to find the development headers for protobuf (since they are in the nix store - /nix/store/h2h5fs8iv2a8rmlkfhr6id6y4jxwd5i1-protobuf-3.21.12/include/google/protobuf/io)

I tried to compile the code anyways on the command line, and got some errors.

I might need an OS specific protobuf install just for the development headers, but I'm pretty sure I should be able to, and just don't know how. Here's what I get when I try to compile:

$ g++ searchReq.pb.cc
In file included from searchReq.pb.cc:4:
searchReq.pb.h:10:10: fatal error: google/protobuf/port_def.inc: No such file or directory
   10 | #include 
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Any tips/pointers would be appreciated. Thanks in advance!

===========================================

Edit: Thank you all, particularly @Xephopiqua@lemmy.ml and @chayleaf@lemmy.ml for the help. After setting the include path (compile) and LD_LIBRARY_PATH (link), things work great.

I ended up writing a small Makefile for convenience in the short run:

INC_FLAGS:=-I$(HOME)/.nix-profile/include -Icpp
LD_FLAGS:=-L$(HOME)/.nix-profile/lib -l protobuf

run: task
	LD_LIBRARY_PATH=$(HOME)/.nix-profile/lib ./task

task:
	g++ $(LD_FLAGS) $(INC_FLAGS) main.cpp cpp/searchReq.pb.cc -o task

regen:
	protoc --python_out=python --cpp_out=cpp searchReq.proto

That's enough to get me going for now.

TODO - read up the NIXOs Wiki C page in more detail

7
1
submitted 1 year ago by figsoda@lemmy.ml to c/nixos@lemmy.ml
8
1
submitted 1 year ago by zako@lemmy.world to c/nixos@lemmy.ml

I have a personal source project I created a shell.nix file for. However, in the project I have also scripts I want to execute periodically non-interactively. Could I use the nix-shell shebang pointing to shell.nix file in order to have the same programs when I use nix-shell interactively and when I launch the scripts?

9
1
submitted 1 year ago by suspectum@lemmy.ml to c/nixos@lemmy.ml

First of all, I'm completely new to Nix and I have no idea what I'm doing. I would like to use it initially as a more general purpose replacement of conda environments for my AI-development workflow. To begin with, I'd like to install nix package manager at my work server where I don't have root access. I tried

sh <(curl -L https://nixos.org/nix/install) --no-daemon

however it tries to create /nix which I cannot do without sudo. I searched everywhere, but I don't seem to find a way to circumvent this.

Thanks!

10
1
Lost In Overlays (lemmy.sdf.org)
submitted 1 year ago by Cebidaez@lemmy.sdf.org to c/nixos@lemmy.ml

I've been messing around with nix flakes to configure my NixOS system and to put the final touches on I wanted to write an overlay of Neovim with the plugins and everything configured with Lua and then use this overlay to install neovim-qt. After reading various docs on Overlays, I get the fundamentals but I don't get where to look to find a list of all the configurable options that an overlay provides? Typically I can look in the home-mananger nix decleration of a package for the options exposed or nixpkgs for the options in configuration.nix. Any help that will dive deeper into overlays or where to find their options would be greatly appreciated!

11
1
Musl on NixOS (discuss.tchncs.de)

I've been hopping around Gentoo and Void the past few days with musl on both, and I'll be going back to NixOS in a bit due to not having enough time to set up either of them. I've realised how little RAM either systems use on musl, though, and I was wondering if there is any chance of replacing glibc with musl on NixOS?

12
1

I've found a few guides but most of them or hard to understand or poorly written, I've done pass trough on proxmox and Arch Linux.

I tries this guide but no luck

https://astrid.tech/2022/09/22/0/nixos-gpu-vfio/

13
1
submitted 1 year ago by curtismchale@lemmy.ca to c/nixos@lemmy.ml

I'm trying to build my first nix package out of the Kana project. My `default.nix' file is below.

When I try to build the application nix tries to fetch https://github.com/ChrisWiegman/kana-cli/archive/v0.10.1.tar.gz which gives a 404. How do I get nix to download the release .tar.gz file to build the application?

{ lib
, buildGoModule
, fetchFromGitHub
, makeWrapper
, go
}:

buildGoModule rec {
  pname = "kana-cli";
  version = "0.10.1";

  src = fetchFromGitHub {
    owner = "ChrisWiegman";
    repo = "kana-cli";
    rev = "v${version}";
    hash = "";
  };

  vendorSha256 = null;

  # This is required for wrapProgram.
  allowGoReference = true;

  nativeBuildInputs = [ makeWrapper ];

  postFixup = ''
    wrapProgram $out/bin/kana-cli --prefix PATH : ${lib.makeBinPath [ go ]}
  '';

  meta = with lib; {
    homepage = "https://github.com/ChrisWiegman/kana-cli";
    description = "WordPress Stuff";
    license = licenses.gpl3;
    maintainers = with maintainers; [ curtismchale ];
  };
}
14
1
submitted 1 year ago by Omniformative@lemm.ee to c/nixos@lemmy.ml

Is anybody using distrobox on NixOS to develop and run software? What are your thoughts on using it?

I feel like it's a huge time saver and makes the use of NixOS easier for beginners. Instead of spending an afternoon or a few days trying to compile or run something using nix, you can spin up a box and seamlessly do your development there. This makes prototyping and testing things out way easier before investing a bunch of time trying to nixify it.

15
1

This is more of a personal dilemma, since I keep finding myself switching back and forth between NixOS and Gentoo every now and then. I've done this twice for each so far ever since I immediately started off my Linux journey with Gentoo, making a quick stop at Arch once when I didn't have enough time to set either of them up properly. Both of them provides a massive amount of control over my system and lets me build my system in weird and interesting ways, e.g. musl, clang, and/or SELinux for Gentoo and impermanence for NixOS (it still kind of blows my mind right now). Personally, I find Gentoo more intuitive, but NixOS is more powerful for managing complex systems, but then again, I don't have any complex systems to manage, only a singular desktop system. I'd love to keep switching back and forth, but I feel like it has become sort of a time sink for me, somewhat hindering my studies, and thus I feel the need to decide which one to settle on, and which one to keep in a VM to mess around with. That brings me to the title of the post, which do you think is better for a simple desktop system? Also, I don't know how viable dual booting is, given that I manage my dotfiles almost entirely with home-manager, and I like to have secure boot.

16
1
Anyone uses Nixpak? (discuss.tchncs.de)

I was looking at ryan4yin's new NixOS book and stumbled upon nixpak, a neat project that , as far as I understand, acts like a sandbox for Nix packages, similar to Flatpak. I've been wanting to try using it for myself, but haven't found any dotfiles I could ~~steal from~~ use as a references. If anyone uses this, I'd love to hear how, and what your experiences are with it.

17
1
AppArmor on NixOS? (discuss.tchncs.de)

I don't quite understand how to set up AppArmor on NixOS, and I can't seem to find anyone's dotfiles which has AppArmor configurations. Is AppArmor support not a thing on NixOS, or is it just configured the regular way and not declaratively?

18
1
Lanzaboote with ZFS? (discuss.tchncs.de)

I've seen a lot more people start to use Lanzaboote for secure boot recently, and I want to try it myself. However, I have a ZFS fiesystem, and I've heard that you can't do secure boot on ZFS, and the ZFS wiki itself says that you need to disable secure boot or the ZFS kernel module won't load. I'm planning on moving my root to tmpfs for impermanence tomorrow anyways, but my home will still be on ZFS. I'm not too knowledgeable in these areas, but I can't see why I can't just sign the ZFS kernel module. Anyone has secure boot on ZFS? I'd like to hear your thoughts on this.

19
1
submitted 1 year ago* (last edited 1 year ago) by Merulox@lemmy.world to c/nixos@lemmy.ml

What I've done is installing

xdg-desktop-portal
libsForQt5.xdg-desktop-portal-kde
libsForQt5.kdialog

and adding

xdg.portal.enable = true;
xdg.portal.extraPortals = [ pkgs.libsForQt5.xdg-desktop-portal-kde ];
environment.sessionVariables.XDG_CURRENT_DESKTOP = "kde";

to my configuration.nix, but while I do get the qt file picker on my web browser, the theming is broken and it looks like this

I currently handle my theming through qt5ct with the line environment.sessionVariables.QT_QPA_PLATFORMTHEME = "qt5ct"

20
1
submitted 1 year ago* (last edited 1 year ago) by figsoda@lemmy.ml to c/nixos@lemmy.ml

GitHub Repository: https://github.com/nix-community/nix-init

Diff: https://github.com/nix-community/nix-init/compare/v0.2.3...v0.2.4

Here is the full changelog for v0.2.4:

Features

  • Go: support dependency inference
  • Rust: improve dependency inference for the following crates: alsa-sys, curl-sys, gtk-sys, gtk4-sys, librocksdb-sys, llvm-sys
  • Go: improve ldflags formatting
  • Add nix and nurl to runtime with environment variables instead of relying on a wrapper

Changes

  • Drop support for nixpkgs 22.11

Fixes

  • Rust: use cargo and rustc instead of rustPlatform.rust.cargo and rustPlatform.rust.rustc
  • Python: fix pythonImportsCheck
  • Python(pyproject): default build-system.requires to setuptools
  • Fix interaction with showAliases = false on nixpkgs 23.11 (#153)

https://github.com/nix-community/nix-init/compare/v0.2.3...v0.2.4

21
1

I've been reading some articles regarding impermanence in NixOS, particularly this, this, this, and this, and I want to set up impermanence on my desktop system. Since it involves deleting my entire root, however, I figured I'd ask for advice here to learn what the best practices are for doing this to minimise risk of data loss, though it isn't too critical since it's a new setup. For reference, I have a Flake + home-manager setup on ZFS root, though I didn't think to do a snapshot when the disk was empty since I didn't know about impermanence when I started out. I also have separate ZFS datasets for /, /home, /nix, /var, and /var/lib. I want to set up impermanence for both root and home, with some persistent directories on home, but I'm not sure if I should set it up on both at once or if I should do root first and then home. Any advice or help is appreciated!

22
1
submitted 1 year ago by Klaymore@sh.itjust.works to c/nixos@lemmy.ml
23
1
submitted 1 year ago by hypevhs@beehaw.org to c/nixos@lemmy.ml

My Chromebook is now end of life so I turn to FOSS. I'm excited for the opportunity to shed the crummy Linux VM (crostini) as well. Anybody tried installing NixOS on a Chromebook? Is it possible, how much trouble did it give you?

24
1
submitted 1 year ago by Klaymore@sh.itjust.works to c/nixos@lemmy.ml

I've been using NixOS for a year now, and recently switched to flakes,

25
1
NixOS appreciation post (lemmy.sysctl.io)
submitted 1 year ago by albert@lemmy.sysctl.io to c/nixos@lemmy.ml

So after being a long-time Fedora/RHEL/CentOS/Rocky/etc user, I finally decided to give NixOS a try after the recent RHEL news.

And BOY and I blown away. You can do so much more than I thought possible with automation on NixOS. It's incredible!

Since I"m so new, I do have a question for you all: What's your go-to resource for learning Nix/NixOS?

Thanks!

view more: next ›

nixos

0 readers
1 users here now

All about NixOS - https://nixos.org/

founded 4 years ago