GithubHelp home page GithubHelp logo

divnix / digga Goto Github PK

View Code? Open in Web Editor NEW
982.0 26.0 110.0 4.86 MB

A flake utility library to craft shell-, home-, and hosts- environments.

Home Page: https://digga.divnix.com

License: MIT License

Nix 98.65% Shell 1.35%
nix flake nix-flake nixos nixos-configuration devos digga dotfiles flake-utils-plus

digga's People

Contributors

almostnobody avatar amarshall avatar b12f avatar bbigras avatar bbjubjub2494 avatar benneti avatar blaggacao avatar blm768 avatar bors[bot] avatar diogox avatar fetsorn avatar gtrunsec avatar jtojnar avatar jwygoda avatar karolisl avatar kidonng avatar l-as avatar linyinfeng avatar lord-valen avatar luxus avatar michaelr avatar montchr avatar narice avatar ncfavier avatar nrdxp avatar pacman99 avatar sohalt avatar teutat3s avatar tomeon avatar ymarkus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

digga's Issues

Incorporate ./shells

Is your feature request related to a problem? Please describe.
I think it is time to share efforts in building user provided dev environments. I also think this template repo leverages the flakes model of sharing to the most elaborate extend. I would be pleased if I could use something like github.com:user/nixflk#devShells.rust of a trusted user as an input to my own variety of devshells.

Describe the solution you'd like
I would like such sharing to evolve around https://github.com/numtide/devshell to provide an advanced and consistent devshell environment.

Describe alternatives you've considered
none β€” inmature thought.

Additional context


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Upstream nixpkgs?

Is your feature request related to a problem? Please describe.
Can I use upstream nixpkgs? Branch release-20.03 now have flake.nix. I tried to switch to it but stuck on error: "flake-registry.json' has unsupported version 2".

Hibernation is disabled by default

Describe the bug
On a fresh nixos config derived from the core branch, `systemctl hibernate fails w/

Failed to hibernate system via logind: Sleep verb "hibernate" not supported

To Reproduce
Steps to reproduce the behavior:

  1. switch to a configuration
  2. check that security.protectKernelImage is true
  3. reboot
  4. attempt to hibernate
  5. See error

Expected behavior
Hibernation should be possible just like in vanilla NixOS.

Additional context
It took me a bit of research to figure out what the cause was. I would argue that, while there's nothing fundamentally bugged with the option, not being able to hibernate and having no indication as to why isn't good UX. I suggest either

  1. yeeting the setting from profile/core and possibly move it to a "hardened" profile, (NixOS has one already)
  2. clearly documenting this fact.

host specific externModules

Is your feature request related to a problem? Please describe.
As briefly described in #44 (comment) there is a problem with externModules if they are supposed to be host specific (like for nixos-hardware).

Describe the solution you'd like
A similarly simple solution to the externModules but host specific would be great.

Additional context
I created this issue because #44 (comment) is closed but the problem is not fully solved yet.

make pass state part of this repo's structure

Is your feature request related to a problem? Please describe.
My passwords are part of my environment, I want them to be persisted under the vigorous structure and management of this repository, instead of acquiring a satellite repository state.

Describe the solution you'd like
Thanks to the advent and example of agenix, it should be at least conceivable to implement a pass-compliant script that honours the agenix precedent of stowing configuration metadata.

Describe alternatives you've considered
This would be so awesome that no alternative comes even close πŸ˜ƒ

Additional context


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Unable to use custom pkgs in home.packages

I have created a custom package for my VPN setup that I want to add to home.packages, but I get the error undefined variable 'myvpn' when trying to build. It works correctly when adding to environment.SystemPackages.

I've created pkgs/networking/myvpn/default.nix and added it to pkgs/default.nix. Is there something I'm missing?

Cannot obtain loader entries

Describe the bug
rebuild boot (or switch) do not create loader entries in systemd-boot

To Reproduce
Steps to reproduce the behavior:

  1. install NixOS unstable
  2. git clone template branch
  3. cp /etc/nixos/hardware-configuration.nix hosts/asus.nix
  4. cp /etc/nixos/configuration.nix hosts/configuration.nix
  5. import configuration.nix in asus.nix
  6. change locale.nix
  7. nix-shell
  8. git add .
  9. backup old config
  10. create link nixos --> $pwd
  11. rebuild asus test # all right
  12. rebuild asus switch #or boot
  13. reboot
  14. nothing(

Expected behavior
I thought I would get new boot entry. Also, when I restart display-manager system is shutdown.

Additional context
Personal branch
EFI mount on /boot

nix path should contain nixpkgs

Describe the bug
See title, (on nixos-unstable) nix-shell and nix-env do not work without nixpkgs in nix_path.

Expected behavior
simple fix would be to just add it in here

            nix.nixPath = let path = toString ../.; in
              [
                "nixos-unstable=${master}"
                "nixos=${nixos}"
                "nixpkgs=${nixos}"
              ];

New generation on rebuild?

Describe the bug
I need to run nixos-rebuild switch --flake '/etc/nixos#myvm' to get a new boot loader generation at boot.

To Reproduce

  1. nix-shell
  2. rebuild vm switch
  3. here constat at boot there is no new generation (EFI boot loader != grub)

Expected behavior
I'm new to nixos, i try to understand all the mecanic. Using some simple receipe, give me a new generation at boot on each switch but with nixflk i feel i need to rebuild myvm switch and `nixos-rebuild switch --flake '/etc/nixos#myvm'.

Additional context
Is-it normal? Maybe i missunderstood something?

Thanks for this project πŸ‘πŸ»

Home-manager external modules from flakes

I was wondering if there is a way to allow adding home-manager modules like we add other external modules in the flake.nix file.

The use case I'm trying to solve is adding nix-doom-emacs's module to my user.

The workaround I currently have in place is to define:

externModules = [
  home.nixosModules.home-manager
  {
  # The workaround:
    home-manager.users.diogox = { pkgs, ... }: {
      imports = [ nix-doom-emacs.hmModule ];
    };
  }
];

Where I import the HM module for my user.

But this defines my username in the flake.nix file, which is not ideal.

Can you see any way to, I guess, either provide a mechanism that will import the HM modules for all users, or provide inputs to the user nix files, so that they can be imported there, like in the example above?

Encrypt with (r)age

Is your feature request related to a problem? Please describe.
I finally want to use age / rage.

Describe the solution you'd like

Something around those lines... (not well thought through)

secrets/** filter=crypt
[filter "crypt"]
	clean = rage -r $(cat ~/.ssh/id_ed25519.pub)
	smudge = rage --decrypt -i ~/.ssh/id_ed25519
	required

Describe alternatives you've considered
none / sops, but sops has ugly configmgt domain overlap with nix.

Additional context

https://git-scm.com/docs/gitattributes


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

how to use NUR?

I tried to edit my users/bbigras2/default.nix file like this:

{
  nurNoPkgs = import (builtins.fetchTarball {
    url = https://github.com/nix-community/NUR/archive/master.tar.gz;
    sha256 = "1fkrrkmxq69z6ai039z9ql7zyqxf3yxz4p0f34bwrz80479bz2wb";
  }) {};

# ...

  imports = [
    nurNoPkgs.repos.rycee.hmModules.emacs-init
  ];
}

I get:

error: value is a function while a set was expected, at /nix/store/ylzadblp5bl370z4n1x2y3nfd6j3phv3-source/users/bbigras2/default.nix:29:5

Does this count as a channel? I saw the warning about using nix-channels in the Readme but I'm not using a channel like this:

{ nurNoPkgs = import <nur> { pkgs = null; }; }

home-manager activate segmentation fault following readme.md upon rebuild NixOS test

Describe the bug
While following the readme at d897b36 and making no changes running rebuild NixOS test resulted in a segmentation fault:

To Reproduce

$ nix flake new -t "github:nrdxp/nixflk" flk
$ cd flk 
$ nix-shell

... snip ...

building '/nix/store/xhqx56n4flybrk9z3bzv58hgp92rc4xi-home-manager-path.drv'...
building '/nix/store/m37r9kcx2x11h4ycczvmgz0wg5a7rx3f-activation-script.drv'...
building '/nix/store/y5xrjk2ysyf1y2nv6b828g48k2yrcnps-home-manager-generation.drv'...
building '/nix/store/xaq18p9syfqkj2zfgspm6pyc2wl2p9pi-activate-nixos.drv'...
error: --- Error ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
builder for '/nix/store/92pvh7yjcycnzhj3v5g28y4n2s6rvz3f-extra-utils.drv' failed with exit code 139; last 10 log lines:
  warning: working around a Linux kernel bug by creating a hole of 4096 bytes in \u2018/nix/store/q9jwr9p86gzrbyb8h5zvl8rg60hm513r-extra-utils/bin/ata_id\u2019
  patching /nix/store/q9jwr9p86gzrbyb8h5zvl8rg60hm513r-extra-utils/bin/busybox...
  patching /nix/store/q9jwr9p86gzrbyb8h5zvl8rg60hm513r-extra-utils/bin/fido_id...
  warning: working around a Linux kernel bug by creating a hole of 4096 bytes in \u2018/nix/store/q9jwr9p86gzrbyb8h5zvl8rg60hm513r-extra-utils/bin/fido_id\u2019
  patching /nix/store/q9jwr9p86gzrbyb8h5zvl8rg60hm513r-extra-utils/bin/cdrom_id...
  warning: working around a Linux kernel bug by creating a hole of 4096 bytes in \u2018/nix/store/q9jwr9p86gzrbyb8h5zvl8rg60hm513r-extra-utils/bin/cdrom_id\u2019
  testing patched programs...
  hello world
  /build/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 101:  6309 Done                    $out/bin/mount --help 2>&1
        6310 Segmentation fault      (core dumped) | grep -q "BusyBox"
error: --- Error ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
1 dependencies of derivation '/nix/store/xin3hp61li5y1xmgij155h5md98qa7kz-stage-1-init.sh.drv' failed to build
error: --- Error ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
1 dependencies of derivation '/nix/store/dhhcji9jshnsmlbhwp64qlsifhiqclcz-initrd-linux-5.4.54.drv' failed to build
error: --- Error ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
1 dependencies of derivation '/nix/store/qh6nk4abfpn0h1jy7v6flggd1swnq8ws-nixos-system-NixOS-20.03.20200802.7dc4385.drv' failed to build

Expected behavior
My configuration is switched to the flake based one until reboot.

Additional context
N/A

enable redistributable firmware by default

Otherwise you can end up with a flake powered system that can't connect to the internet if it 1) has no ethernet port and 2) requires a non-free iwlwifi driver.

The nixos hardware scan includes this by default when applicable.

ARM aarch64 Support

Quite a few people might want to get up to speed with deploying their RPi (eg. Home automation, etc).

I'm going to think of a way on how to integrate it into flk so that the UX of getting started with raspberry (and other board) builds is cool.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Multiarch support?

Is your feature request related to a problem? Please describe.
Not necessarily, although i don't think this will work with arm builds. With the growing rise of arm as a desktop/laptop replacement, it's important to have templates like these adaptable to those needs.

Describe the solution you'd like
I don't have any solution to provide, but I do see that there are some x86-64 assumptions in flake.nix and probably other places. Ideally down to generating an image for an arm system would work. For example, have hosts/niximg-x86-64.nix and hosts/niximg-aarch64.nix

Additional context
I have been monitoring and studying this repository for a few weeks now and am definitely interested and like how things are shaping up. I've been leaning towards using it in place of what ive already started, but I have several arm-based machines that I want to work well with my configuration.

Home manager on Non-nixos systems

Is your feature request related to a problem? Please describe.
I believe that at the moment any home manager configuration you describe in nixflk cannot be used on a non-nixos system, even though this is a known use case of home manager.

Describe the solution you'd like
An easy way to apply home manager configurations on non-nixos systems with the existing solution.

This could maybe be some command that takes in a user and applies the home-manager.users. to the current home directory.

Or perhaps each user in home-manager.users could get an export in the flake.nix so they can be applied with nixos-rebuild(I think this is possible). I'm still learning flakes, so I'm not sure about implementation details.

I think home manager configurations can be exported as packages with the activationPackage attribute, so maybe a package for each user.

Describe alternatives you've considered
I think you could make a home.nix that takes in the relevant config and pass that to hm switch.
Also there might already be a way to do this with nixflk and I just don't know.

Additional context
This was discussed on the home-manager repo: nix-community/home-manager#1510. It looks like the configuration input for home-manager is a file, so I'm not sure how that would work with the way nixflk is formatted, since the users files include other things for the nixos configuration.

incomplete substituters file

Describe the bug
I think the incompleteness of
nixConfig.substituters = [ "https://nrdxp.cachix.org" ];
confuses nix, I follow nixos-unstable with my pkgs and had to add

# add links for binary caches here
  nixConfig.substituters = [
    "https://cache.nixos.org/"
    "https://nrdxp.cachix.org"
    "https://nix-community.cachix.org"
  ];

to again use the binary cache.

To Reproduce
Use flakes

  1. maybe switch to nixos.url = "nixpkgs/nixos-unstable";
  2. rebuild system

To Fix
add

  nixConfig.substituters = [
    "https://cache.nixos.org/"
    "https://nrdxp.cachix.org"
    "https://nix-community.cachix.org"
  ];

Expected behavior
have completer substituters (or none?).
Also I am a bit confused, do we still rely on the cachix configuration -- if not I think it should be deleted for it to be less confusing.

I think this PR is related: #71.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

home-manager-path error, rm no operands

Describe the bug
I've tried to switch to nixflk in nix-shell, but i havent been able to do a successful build

To Reproduce
Steps to reproduce the behavior:

  1. have an existing NixOS @ 20.09
  2. nix-shell and flk (hostname) switch

Expected behavior
a flake gen is rebulit, from a previous config that included nix 2.4 and home-manager

Additional context

$ nix --version                                          
nix (Nix) 2.4pre20201201_5a6ddb3

full log:

[flk]$ flk chapterhouse switch
warning: Git tree '/home/tgunnoe/src/nixflk' is dirty
building the system configuration...
warning: Git tree '/home/tgunnoe/src/nixflk' is dirty
error: --- Error ---------------------------------------------------------------------------------------------------------------------- nix
builder for '/nix/store/iv179g9mc9adic8mswj862z0iqzxr64n-home-manager-path.drv' failed with exit code 1; last 3 log lines:
  created 0 symlinks in user environment
  rm: missing operand
  Try 'rm --help' for more information.
error: --- Error ---------------------------------------------------------------------------------------------------------------------- nix
1 dependencies of derivation '/nix/store/hibp5jidfxfb4bqx4y9k8f6b48bsb2ic-home-manager-generation.drv' failed to build
error: --- Error ---------------------------------------------------------------------------------------------------------------------- nix
1 dependencies of derivation '/nix/store/42n3xq2ckx7jcagv8smwb8gavhm1znka-user-environment.drv' failed to build
error: --- Error ---------------------------------------------------------------------------------------------------------------------- nix
1 dependencies of derivation '/nix/store/48r1j45aflfiw6cn9zg32wpbsm828mv5-etc.drv' failed to build
error: --- Error ---------------------------------------------------------------------------------------------------------------------- nix
1 dependencies of derivation '/nix/store/0a9ldka1nh7bc5v1fpzh8xjjv642aax5-nixos-system-chapterhouse-20.09.20201214.7362dab.drv' failed to build

cross compile support

Is your feature request related to a problem? Please describe.
On my attempt to cross-compile for a RaspberryPi host, I got frustrated with a refusal to cross compile.

(I'm a layman, more than others who claim it, but) I believe, the reason is that nixflk currently doesn't hanle the crossSytem attribute, which I reference from my own context and ongoing line of thought here and here.

Describe the solution you'd like
Not sure how to sort this out short vs long term. A consolidated numtide/flake-utils backed solution would be ideal. (see the linked passages).

Describe alternatives you've considered
Too little a knowledge to be serious on alternatives.

Additional context

I'm trying to get some PI-based "home-automation" going.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Run `nix-shell` got `error: invalid character '/' in name 'opt/nix.conf'`

I hit the same issue s9gf4ult mentioned in the discourse thread.

I cloned the repo, and tried to run nix-shell in the repo folder, I got this error:

> nix-shell
error: invalid character '/' in name 'opt/nix.conf'
(use '--show-trace' to show detailed location information)

> nix-shell --show-trace
error: while evaluating the attribute 'NIX_CONF_DIR' of the derivation 'nix-shell' at /nix/store/14c7vyk2m7mkl2n69rkfkm7grf0z8c5h-nixos-19.03.173684.c8db7a8a16e/nixos/pkgs/build-support/mkshell/default.nix:32:3:
invalid character '/' in name 'opt/nix.conf'

It seems related to the code in shell.nix:

  NIX_CONF_DIR = let
    current = pkgs.lib.optionalString (builtins.pathExists /etc/nix/nix.conf)
      (builtins.readFile /etc/nix/nix.conf);

    nixConf = pkgs.writeTextDir "opt/nix.conf" ''
      ${current}
      experimental-features = nix-command flakes ca-references
    '';
  in "${nixConf}/opt";

I'm still running 19.03, nix version is:

> nix --version
nix (Nix) 2.2.2

Prepare for new default branch `core`

This issue is a warning to users that the default branch will soon become core on Feb. 5, 2021. This is in response to the discussion in #100.

Core is analogous to the current bare branch. The template branch, with all it's existing profiles, will become the community branch.

These branches already exist and no further work will be pushed to template.

pinging contributors for awareness:
@blaggacao @jtojnar @lourkeur @bbigras @adamscott @codygman @diogox @ncfavier @benneti @demyanrogozhin @Pacman99

Build installer iso from unstable nixpkgs.

Is your feature request related to a problem? Please describe.
To run nixos-install --flake directly from an installer iso, the --impure argument is required. The unstable version of "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" provides this argument, it isn't in nixos. I want to build an installer iso that has the unstable version of nixos-install.

Describe the solution you'd like
I don't know how to do this within the design of this template. I'm pretty new to nix, so my limited understanding of this template may very well be wrong.

AFAIKT, the only mechanism to use packages from unstable is via the overlays mechanism. I don't know how that relates to directly importing the installer-cd-minimal.nix. I tried to find what package provides nixos-install, but didn't get very far in the nix source code.

I managed to work around this in a very hacky way. I replaced all references to nixos with master.

Maybe a module can be added that provides an installer.enable option along with an installer.fromUnstable option.

remap global keys easily

Is your feature request related to a problem? Please describe.
Based on https://discuss.kakoune.com/t/key-maps-as-key-locations/1414, we want to make keymaps part of a consolidated global environment state in a way that users can encode different custom key layouts easily.

Describe the solution you'd like
For best onboarding experience, we might want a nixflk global keymap wizard, so that once nix-community/home-manager#1685 is implemented, we could tell people to run flk keymap (or a surrogate) in order to key their muscle memory aliases like so:

Press Left Pinky on home row position: ...
Press Left Pinky 1 Up from home row position: ...
Press Left Pinky 1 Down from home row position: ...

constructing:

{
  LPinky = "a";
  LRing  = "s";
  LRingUp = "d";
  LMiddleDown = "m";
  LMiddle = "h";
  RMiddle = "e";
  RMiddleDown = "l";
  RRingUp = "p";
  RRing = "o";
  RPinky = "i";
}

Describe alternatives you've considered
This should actually be a standalone implementation, I'm putting a thought anchor here so it can be conceived in the context of making nixflk even more stellar.

Additional context


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Command `rebuild` broken with newest Nix: unrecognised flag '-c'

Describe the bug
After automatic upgrade to fresh Nix v.2.4pre20200501_941f952 command nix-shell --command "rebuild switch" stop working.
Probably due changes in arguments to nix run sub-command.

To Reproduce
Steps to reproduce the behavior:

  1. git checkout -b test origin/template
  2. Create host configuration as described in README
  3. Run command: nix-shell --command "rebuild switch"
  4. See error:
error: unrecognised flag '-c'
Try 'nix --help' for more information

Expected behavior
Nix starts building derivation.

add github action for cachix build ci

I've been, so far, pushing builds to my cachix manually, but an automated github action would allow every package to be built, on every branch, including the devshells and inputs saving lots of build time.

A reference implementation will have to be adapted to this project, but it shouldn't be too difficult.

cannot look up '<nixpkgs>' in pure evaluation mode

[cody@nixos:~]$ nix flake new -t "github:nrdxp/nixflk" flk # 2bdead324bbf15685db291cdd15c961d9d0d51a9
[cody@nixos:~]$ cd flk/ 
direnv: loading ~/flk/.envrc
direnv: using flake
direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_STORE +NM +OBJCOPY +OBJDUMP +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +TMPDIR +buildInputs +builder +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +dontAddDisableDepTrack +name +nativeBuildInputs +nobuildPhase +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS

[cody@nixos:~/flk]$ rebuild NixOS test
[sudo] password for cody: 
building the system configuration...
error: --- ThrownError ------------------------------------------------------------------- nix
at: (217:11) in file: /nix/store/wkjaivy3f1viwbj574n7p30wvd6llssi-source/modules/modules.nix

   216|         else
   217|           <nixpkgs>);
      |           ^
   218|       _module.args.pkgs = lib.mkDefault pkgs;

cannot look up '<nixpkgs>' in pure evaluation mode (use '--impure' to override)
(use '--show-trace' to show detailed location information)

Shouldn't everyone that uses this flake be getting this error? It seems like it's only me but that defeats the purpose of flakes having more hermetic builds right?

bad idea to have make-linux-fast-again by default?

I don't know if it's possible to import imports = [ ../profiles ] directly but someone importing ../profiles/misc might not realize that it will disable the meltdown/spectre mitigations.

Maybe it should only be importable directly with the path containing something like:
DISABLE_SECURITY_I_KNOW_THE_RISK.

Make bare (on fork)

If anyone wants to create a quick bare variant of the latest advancements.

This seems to work:

$ git show bare:mkbare.sh | zsh

(I'll try to find out how to do git format patch on the diff so that history will remain consistent and no force pushing is required, so that in principale #91 workflows can be supported also for bare)

error: flake '/home/bbigras/nixflk' does not provide attribute 'nixosConfigurations.new_host.config.system.build.toplevel'

Describe the bug
I got this error message. Note that I didn't edit the config file yet. Did I need to do it first. In the Readme it seems I can rebuild before.

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/nrdxp/nixflk.git
  2. cd nixflk/
  3. nix-shell
  4. git checkout -b moi template
  5. nixos-generate-config --show-hardware-config > ./hosts/new_host.nix
  6. sudo ln -s $PWD /etc/nixos
  7. rebuild new_host switch
[nix-shell:~/nixflk]$ rebuild new_host switch
evaluating file '/nix/store/2vdffwd9qpamvk9z3qhaig9fs0dam0cw-nix-2.4pre20191022_9cac895/share/nix/corepkgs/derivation.nix'
using revision 1 of repo '/home/bbigras/nixflk'
evaluating file '/nix/store/89jnlh3dlszwbnsj291s8pq1bvn9yz6a-source/flake.nix'
evaluating file '/nix/store/89jnlh3dlszwbnsj291s8pq1bvn9yz6a-source/hosts/default.nix'
evaluating file '/nix/store/89jnlh3dlszwbnsj291s8pq1bvn9yz6a-source/lib/utils.nix'
downloading 'https://api.github.com/repos/nrdxp/nixpkgs/tarball/1e232452ed4c57e9968f4342d9ba044d36403928'...
unpacking 'https://api.github.com/repos/nrdxp/nixpkgs/tarball/1e232452ed4c57e9968f4342d9ba044d36403928'...
evaluating file '/nix/store/lwp8hnp8z5i11rpjkjcp67h7zvl28kzd-source/flake.nix'
evaluating file '/nix/store/lwp8hnp8z5i11rpjkjcp67h7zvl28kzd-source/lib/default.nix'
evaluating file '/nix/store/lwp8hnp8z5i11rpjkjcp67h7zvl28kzd-source/lib/fixed-points.nix'
evaluating file '/nix/store/lwp8hnp8z5i11rpjkjcp67h7zvl28kzd-source/lib/attrsets.nix'
evaluating file '/nix/store/lwp8hnp8z5i11rpjkjcp67h7zvl28kzd-source/lib/lists.nix'
evaluating file '/nix/store/lwp8hnp8z5i11rpjkjcp67h7zvl28kzd-source/lib/strings.nix'
evaluating file '/nix/store/lwp8hnp8z5i11rpjkjcp67h7zvl28kzd-source/nixos/lib/eval-config.nix'
[17.3 MiB DL]
error: flake '/home/bbigras/nixflk' does not provide attribute 'nixosConfigurations.new_host.config.system.build.toplevel'

Expected behavior

Additional context

Adding the overlay of a nix flake

πŸ‘‹ This template gave me the right boost to start porting my client machine configuration to flakes, many thanks!

I would like to add the overlay that another nix flake provides, e.g., nixpkgs-wayland.

What would be the most optimal way to do so? Since I am talking about packages that both system and user (via home-manager configuration) might use, I am particularly interested in a solution which addresses both cases.

NUR support

I noticed that this template used to have NUR support but it has since been removed.

I was wondering why that is?

I ask, because I'm using this wonderful template, and I had to spend a day or two figuring out how to add NUR support.
I feel like I managed to do it by blind luck, given how little I know of Nix. And I'd like to spare someone else from having to do the same in the future.

I could make a PR with the changes that worked for me. Turned out pretty elegant, I think πŸ˜„

What do you think?

commit hook and deleting file

Describe the bug
I tried to delete a file but then git commit failed.
As I do not now the reason exactly I simply moved .git/hooks temporarily to another place, then I was able to add the commit message.

To Reproduce
Steps to reproduce the behavior:

  1. Delete a file
  2. commit
  3. try to "git commit -m asdf"
  4. See error

Expected behavior
Git commit hook should not interfere with usual git actions.

implement apps as fallback or not at all

https://github.com/nrdxp/nixflk/blob/d0fe508da20695bd72c1a5eebd3cb113778366ac/flake.nix#L88-L104

nix run falls back to inspecting the self.packages attribute set.

app declarations are only needed when in packages.<system>.<pname> and /bin/<name> and are not euqal, for example:

packages.<system>.coreutils
but:
/bin/cat

It appears to me for the sake of simplicity, the app generation could be dropped. Those naming conflicts are extremely rare and the user could probably declare apps manually in such cases.

using cookiecutter or similar tools to bootstrap the template

Is your feature request related to a problem? Please describe.
As of now we endup with lot of files not necessarily used.

Describe the solution you'd like
Using such tool we can set the

  • default user name
  • new-host file's name -> automatically generate the file under hosts folder after entering the name as from generate-config
  • set of profiles that user wants to use
  • desktop environment that user wants
  • etc.,
  • an update script to pull down latest changes from this repo

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Adding and using the nixos-hardware flake

Hi!
I'm having problems using the nixos-hardware flake. I'm pretty pretty new to flakes and have not been using NixOS for very long so maybe I'm missing something obvious. Been trying to figure out what's causing the infinite recursion but I'm completely stuck, any pointers in the right direction is welcomed.

I've done the following:
Added the nixos-hardware flake to inputs:

  inputs =
    {
      master.url = "nixpkgs/master";
      nixos.url = "nixpkgs/release-20.09";
      home.url = "github:nix-community/home-manager/release-20.09";
      flake-utils.url = "github:numtide/flake-utils";

      # Extras
      emacs-overlay.url  = "github:nix-community/emacs-overlay";
      nixos-hardware.url = "github:NixOS/nixos-hardware/master";
      nur.url = "github:nix-community/NUR";
    };

  outputs = inputs@{ self, home, nixos, master, flake-utils, emacs-overlay, nixos-hardware, nur }:
...

Import my laptops configuration from the nixos-hardware flake in my <hostname.nix> file:

{ config, lib, pkgs, nixos-hardware, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
      nixos-hardware.nixosModules.lenovo-thinkpad-t470s
    ];
}

I'm then hit with infinite recursion error when trying to build, nix flake check outputs the following:

error: --- EvalError ----------------------------------------------------------------------------- nix
at: (262:28) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   261|         value = builtins.addErrorContext (context name)
   262|           (args.${name} or config._module.args.${name});
      |                            ^
   263|       }) requiredArgs);

infinite recursion encountered
--------------------------------------------- show-trace ---------------------------------------------
trace: while evaluating the module argument `nixos-hardware' in ":anon-1071":
trace: while evaluating 'isFunction'
at: (333:16) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/trivial.nix

   332|   */
   333|   isFunction = f: builtins.isFunction f ||
      |                ^
   334|     (f ? __functor && isFunction (f.__functor f));

trace: from call site
at: (148:12) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   147|       loadModule = args: fallbackFile: fallbackKey: m:
   148|         if isFunction m || isAttrs m then
      |            ^
   149|           unifyModuleSyntax fallbackFile fallbackKey (applyIfFunction fallbackKey m args)

trace: while evaluating 'loadModule'
at: (147:53) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   146|       # Like unifyModuleSyntax, but also imports paths and calls functions if necessary
   147|       loadModule = args: fallbackFile: fallbackKey: m:
      |                                                     ^
   148|         if isFunction m || isAttrs m then

trace: from call site
at: (185:22) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   184|           let
   185|             module = loadModule args parentFile "${parentKey}:anon-${toString n}" x;
      |                      ^
   186|             collectedImports = collectStructuredModules module._file module.key module.imports args;

trace: while evaluating the attribute 'disabled'
at: (180:13) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   179|           collectResults = modules: {
   180|             disabled = concatLists (catAttrs "disabled" modules);
      |             ^
   181|             inherit modules;

trace: while evaluating anonymous lambda
at: (202:31) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   201|           disabledKeys = map moduleKey disabled;
   202|           keyFilter = filter (attrs: ! elem attrs.key disabledKeys);
      |                               ^
   203|         in map (attrs: attrs.module) (builtins.genericClosure {

trace: from call site
trace: while evaluating 'filterModules'
at: (198:36) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   197|       # modules recursively. It returns the final list of unique-by-key modules
   198|       filterModules = modulesPath: { disabled, modules }:
      |                                    ^
   199|         let

trace: from call site
at: (209:7) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   208|     in modulesPath: initialModules: args:
   209|       filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);
      |       ^
   210| 

trace: while evaluating anonymous lambda
at: (208:37) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   207| 
   208|     in modulesPath: initialModules: args:
      |                                     ^
   209|       filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);

trace: from call site
at: (86:25) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

    85|       merged =
    86|         let collected = collectModules
      |                         ^
    87|           (specialArgs.modulesPath or "")

trace: while evaluating 'reverseList'
at: (393:17) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/lists.nix

   392|   */
   393|   reverseList = xs:
      |                 ^
   394|     let l = length xs; in genList (n: elemAt xs (l - n - 1)) l;

trace: from call site
at: (90:33) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

    89|           ({ inherit lib options config; } // specialArgs);
    90|         in mergeModules prefix (reverseList collected);
      |                                 ^
    91| 

trace: while evaluating 'byName'
at: (321:25) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   320|       */
   321|       byName = attr: f: modules:
      |                         ^
   322|         foldl' (acc: module:

trace: from call site
at: (329:21) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   328|       # an attrset 'name' => list of submodules that declare β€˜name’.
   329|       declsByName = byName "options" (module: option:
      |                     ^
   330|           [{ inherit (module) _file; options = option; }]

trace: while evaluating 'flip'
at: (138:16) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/trivial.nix

   137|   */
   138|   flip = f: a: b: f b a;
      |                ^
   139| 

trace: from call site
at: (341:23) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   340| 
   341|       resultsByName = flip mapAttrs declsByName (name: decls:
      |                       ^
   342|         # We're descending into attribute β€˜name’.

trace: while evaluating the attribute 'matchedOptions'
at: (373:14) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

   372|     in {
   373|       inherit matchedOptions;
      |              ^
   374| 

trace: while evaluating 'recurse'
at: (273:23) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/attrsets.nix

   272|     let
   273|       recurse = path: set:
      |                       ^
   274|         let

trace: from call site
at: (281:8) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/attrsets.nix

   280|         in mapAttrs g set;
   281|     in recurse [] set;
      |        ^
   282| 

trace: while evaluating 'mapAttrsRecursiveCond'
at: (271:36) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/attrsets.nix

   270|   */
   271|   mapAttrsRecursiveCond = cond: f: set:
      |                                    ^
   272|     let

trace: from call site
at: (98:28) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

    97|           # For definitions that have an associated option
    98|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
      |                            ^
    99| 

trace: while evaluating 'evalModules'
at: (21:17) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/modules.nix

    20|      evalModules) and the less declarative the module set is. */
    21|   evalModules = { modules
      |                 ^
    22|                 , prefix ? []

trace: from call site
at: (58:12) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/nixos/lib/eval-config.nix

    57|   # system configuration.
    58|   inherit (lib.evalModules {
      |            ^
    59|     inherit prefix check;

trace: while checking the NixOS configuration 'nixosConfigurations.ravenor'
at: (194:41) in file: /nix/store/l13lszj9qgpm1r7d8h8bhpq9ik1s5673-source/lib/attrsets.nix

   193|   */
   194|   nameValuePair = name: value: { inherit name value; };
      |                                         ^
   195| 

trace: while checking flake output 'nixosConfigurations'
at: (39:9) in file: /nix/store/ml7bzqjybd1c30hwxq1ia766rsr2q1fv-source/flake.nix

    38|       outputs = {
    39|         nixosConfigurations =
      |         ^
    40|           import ./hosts (recursiveUpdate inputs {

Can't add custom pkgs to systemPackages.

Describe the bug
Importing packages from the pkgs directory results in an error.

error: --- EvalError --- nix
at: (13:34) in file: /nix/store/d6dwnk6fnml3l19ch409w8nmvq3hkkrv-source/hosts/niximg.nix

12|   networking.networkmanager.enable = true;
13|   environment.systemPackages = [ pkgs.libinih ];
  |                                  ^
14| }

attribute 'libinih' missing

To Reproduce

  1. Checkout repo
  2. Modify niximg.nix to include the line environment.systemPackages = [ pkgs.libinih ]; and { modulesPath, pkgs, ... }: { at the top.
  3. Run flk img in the nix-shell (after fixing the bug #64)

Expected behavior
I expected the image to build.
According to DOC.md:

All expressions in both modules/list.nix and pkgs/default.nix are available globally, anywhere else in the repo. They are additionally included in the nixosModules and overlay flake outputs, respectively. Packages are automatically included in the packages output as well.

Additional context
I pulled directly from this repo, latest commit (09f0bbd). Reverting to the commit before seems to work (9f561b8).

use github actions for cachix ci

I've been, so far, pushing builds to my cachix manually, but an automated github action would allow every package to be built, on every branch, including the devshells and inputs.

A reference implementation will have to be adapted to this project, but it shouldn't be too difficult.

Permission denied

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/nrdxp/nixflk.git
  2. cd nixflk/
  3. nix-shell
  4. git checkout -b moi template
  5. nixos-generate-config --show-hardware-config > ./hosts/new_host.nix
  6. sudo ln -s $PWD /etc/nixos
  7. git add hosts/new_host.nix
  8. rebuild new_host switch

I get:

[...]
building '/nix/store/yk0507743hp82yldxmbkvsxdzfwzv1jw-nixos-system-new_host-20.03.20191229.1e23245.drv'...
[207 built, 376 copied (992.9 MiB), 238.2 MiB DL]
updating GRUB 2 menu...
mkdir /boot/grub: Permission denied at /nix/store/hdana4ajhbdz24pl1f20jfbq8izm2kcn-install-grub.pl line 81.

and if I use sudo I get:

[nix-shell:~/nixflk]$ sudo rebuild new_host switch
[sudo] password for bbigras:
error: experimental Nix feature 'nix-command' is disabled

I wonder if it's caused by sudo stripping some env vars.

Expected behavior

Additional context

  • system: "x86_64-linux"
  • host os: Linux 4.19.92, NixOS, 19.09.1776.b926503738c (Loris)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.4pre20191022_9cac895
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

ovoverlay import mechanics don't seem to allow file name attribute discrepancy and also do not distinguish between nixos and master

Because of
https://github.com/nrdxp/nixflk/blob/d0fe508da20695bd72c1a5eebd3cb113778366ac/flake.nix#L51

in conjunction with

https://github.com/nrdxp/nixflk/blob/d0fe508da20695bd72c1a5eebd3cb113778366ac/lib/utils.nix#L89-L92

https://github.com/nrdxp/nixflk/blob/d0fe508da20695bd72c1a5eebd3cb113778366ac/overlays/kakoune.nix#L13

would not be made available in pkgs.

In general, I'm not sure if "too much magic" here is really a win or if overlays could be managed in a more transparent manner.

I really like the way how flake-utils's simpleFlake commands name spacing (see #60).
That approach doesn't limit overlaying "stock" packages, though, through a little extra helper that would read overlays from a non name spaced portion of the overlay file:

final: prev: {
   nixflk = {}; # name spaced overlays -- sharing friendly as `self.overlay` (namespaced, too!)
   utillinux = prev.util-linux; # non name spaced overlays -- ought not to be  exported as `self.overlay` (sic!) but available under `self.overlays.utillinux`
}

On the other hand it seems that we need a way to target an overlay either at master or at nixos, since on the contrary we expose the users to nasty and unexpected side effects of the implementation detail that genPackages targets both branches.

revamp docs

We need a more thorough mechanism for documentation covering the following bases:

  • all library functions
  • profile blurbs
  • repo layout description
  • flk command
  • user blurbs
  • common examples of various actions
  • various integration docs
    • deploy-rs
    • NUR
    • devshell

Tracking #113


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.