nix shell flakes

This commit is contained in:
foglar 2025-03-14 17:04:28 +01:00
parent fde46772c8
commit 6ae3af2133
2 changed files with 71 additions and 8 deletions

View File

@ -1,20 +1,20 @@
# Nix # Nix
- [x] Own nixos ISO
- [x] Inputs in Nix
- [x] NixOS builders and writers
- [x] Nix Shell
- [x] Nix writers
- [ ] Ovverrides and overlays
- [ ] NixOS helper
- [ ] [Nixhub](https://www.nixhub.io/)
- [ ] Nix scripts - [ ] Nix scripts
- [ ] Nix home-manager, standalone vs sysconfig module - [ ] Nix home-manager, standalone vs sysconfig module
- [ ] Plasma manager - [ ] Plasma manager
- [ ] Stylix - [ ] Stylix
- [ ] NixOS Everywhere, NixOS Anywhere - [ ] NixOS Everywhere, NixOS Anywhere
- [x] Inputs in Nix
- [ ] Nix language (if else statements, pipes, and other interesting things) - [ ] Nix language (if else statements, pipes, and other interesting things)
- [ ] Nix Modules - [ ] Nix Modules
- [ ] Vlastní options - [ ] Vlastní options
- [ ] Nix fetching - [ ] Nix fetching
- [ ] Impermanence - [ ] Impermanence
- [x] Own nixos ISO
- [ ] NixOS helper
- [x] NixOS builders and writers
- [ ] Ovverrides and overlays
- [ ] Nix Shell
- [x] Nix writers
- [ ] [Nixhub](https://www.nixhub.io/)

View File

@ -180,6 +180,12 @@ nix flake show github:kamadorueda/alejandra
--- ---
# Nová flake
* `nix flake init --template templates#full`
---
# Inputs # Inputs
* `nix flake metadata --json | jq` - zobrazí vstupy * `nix flake metadata --json | jq` - zobrazí vstupy
@ -228,11 +234,68 @@ nix build /etc/nixos#nixosConfigurations.nixos.config.system.build.toplevel
# Virtual machine # Virtual machine
* `nix run github:nix-community/nixos-generators -- -c ./flake.nix --flake '#default' -f vm --disk-size 20480` * `nix run github:nix-community/nixos-generators -- -c ./flake.nix --flake '#default' -f vm --disk-size 20480`
* `nixos-rebuild build-vm --flake ~/my-system-flake#default`
* možnost generovat pro různé platformy (Amazon E2C, Docker, ISO, Proxmox, VMware, vagrant, qcow, ...) * možnost generovat pro různé platformy (Amazon E2C, Docker, ISO, Proxmox, VMware, vagrant, qcow, ...)
* [https://github.com/nix-community/nixos-generators](https://github.com/nix-community/nixos-generators) * [https://github.com/nix-community/nixos-generators](https://github.com/nix-community/nixos-generators)
--- ---
# Nix Shell
- `nix-shell ./`
```nix
# shell.nix
{pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
packages = [
(pkgs.python311.withPackages(pypkgs: with pypkgs; [
requests
numpy
pygobject3
]))
]
}
```
---
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem
(
system: let
pkgs = import nixpkgs {
inherit system;
};
in
with pkgs; {
devShells.default = mkShell {
packages = [
(pkgs.python311.withPackages (pypkgs:
with pypkgs; [
requests
numpy
pygobject3
]))
];
};
}
);
}
```
---
# Nix language # Nix language
* `nix-repl` nebo `nix-instantiate --eval foo.nix` * `nix-repl` nebo `nix-instantiate --eval foo.nix`