package ve flake

This commit is contained in:
foglar 2025-03-15 07:30:02 +01:00
parent 851990d548
commit 85f739958f

View File

@ -46,7 +46,7 @@ nix run nixpkgs#cowsay #New
---
# Commandy
# Příkazy
| Command | Na |
| -------------- | ---------------------------------- |
@ -183,12 +183,6 @@ nix flake show github:kamadorueda/alejandra
---
# Nová flake z full templatu
* `nix flake init --template templates#full`
---
# Inputs
* `nix flake metadata --json | jq` - zobrazí vstupy
@ -300,6 +294,58 @@ pkgs.mkShell {
---
# Jak zabalit aplikaci do flake?
---
```nix
outputs = {self, ...} @ inputs: let
supportedSystems = ["aarch64-linux" "i686-linux" "x86_64-linux"];
forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor =
forAllSystems (system: import inputs.nixpkgs {inherit system;});
in {
packages = forAllSystems (system: let
pkgs = nixpkgsFor.${system};
in {
default = self.packages.${system}.nix-install;
nix-install = pkgs.writeShellApplication {
name = "nix-install";
runtimeInputs = with pkgs; [git busybox gum];
text = ''
echo "This is shell aplication in flake"
'';
};
});
apps = forAllSystems (system: {
default = self.apps.${system}.nix-install;
nix-install = {
type = "app";
program = "${self.packages.${system}.nix-install}/bin/nix-install";
};
});
};
```
---
* spuštění aplika e pomocí `nix run`
* `https://github.com/nixFreak/testApp`
* `nix run github:nixFreak/testApp`
* nebo přidání do flake inputů
```nix
environment.systemPackages = [
inputs.install-script.packages.${system}.default
inputs.zen-browser.packages.${system}.default
];
```
---
# Nix language
* `nix-repl` nebo `nix-instantiate --eval foo.nix`
@ -500,8 +546,10 @@ print("Hello world!")
---
# [EWW Flake](https://github.com/elkowar/eww/blob/master/flake.nix)
* # [EWW Flake](https://github.com/elkowar/eww/blob/master/flake.nix)
* # `nix flake init --template templates#full`
---
# **Používejte Nix**
# **Používejte Nix!**