feat: added Nix flake
This commit is contained in:
		
							parent
							
								
									da8d82e09f
								
							
						
					
					
						commit
						b91e73662a
					
				
					 3 changed files with 135 additions and 0 deletions
				
			
		
							
								
								
									
										43
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										43
									
								
								README.md
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -31,6 +31,9 @@
 | 
			
		|||
 | 
			
		||||
To install Cutekit, you may use your favourite package manager if it is available. Or you can install it manually by following the instructions below.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### By using pip
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ git clone https://github.com/cute-engineering/cutekit
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,6 +45,46 @@ $ cd cutekit
 | 
			
		|||
$ pip install --user -e .
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### By using Nix
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ git clone https://github.com/cute-engineering/cutekit
 | 
			
		||||
 | 
			
		||||
$ cd cutekit
 | 
			
		||||
 | 
			
		||||
# If you want to use the latest version of Cutekit, you can switch to the dev branch.
 | 
			
		||||
# $ git switch dev
 | 
			
		||||
 | 
			
		||||
$ nix shell ./meta/nix
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Or you can also use Cutekit in your flakes. For example:
 | 
			
		||||
 | 
			
		||||
```nix
 | 
			
		||||
{
 | 
			
		||||
  description = "Hello cutekit";
 | 
			
		||||
  inputs = {
 | 
			
		||||
    # If you want to use the latest version of Cutekit, you can specify the dev branch.
 | 
			
		||||
    # cutekit.url = "github:cute-engineering/cutekit/dev?dir=meta/nix";
 | 
			
		||||
    cutekit.url = "github:cute-engineering/cutekit?dir=meta/nix";
 | 
			
		||||
    nixpkgs.url = "nixpkgs/nixos-23.11";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  outputs = {self, nixpkgs, cutekit, ... }:
 | 
			
		||||
    let
 | 
			
		||||
      pkgs = nixpkgs.legacyPackages.x86_64-linux;
 | 
			
		||||
      ck = cutekit.defaultPackage.x86_64-linux;
 | 
			
		||||
    in {
 | 
			
		||||
      devShells.x86_64-linux.default = pkgs.mkShell {
 | 
			
		||||
        packages = with pkgs; [
 | 
			
		||||
          ck
 | 
			
		||||
        ];
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Quick-start
 | 
			
		||||
 | 
			
		||||
- If you directly want to start using Cutekit for a new project, you can just run `$ ck I host` and it will create a new project in the host directory (you can rename it later).
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										60
									
								
								meta/nix/flake.lock
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								meta/nix/flake.lock
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,60 @@
 | 
			
		|||
{
 | 
			
		||||
  "nodes": {
 | 
			
		||||
    "flake-utils": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "systems": "systems"
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1705309234,
 | 
			
		||||
        "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nixpkgs": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1705774713,
 | 
			
		||||
        "narHash": "sha256-j6ADaDH9XiumUzkTPlFyCBcoWYhO83lfgiSqEJF2zcs=",
 | 
			
		||||
        "owner": "NixOS",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "rev": "1b64fc1287991a9cce717a01c1973ef86cb1af0b",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "id": "nixpkgs",
 | 
			
		||||
        "ref": "nixos-23.11",
 | 
			
		||||
        "type": "indirect"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "root": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "flake-utils": "flake-utils",
 | 
			
		||||
        "nixpkgs": "nixpkgs"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "systems": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1681028828,
 | 
			
		||||
        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
 | 
			
		||||
        "owner": "nix-systems",
 | 
			
		||||
        "repo": "default",
 | 
			
		||||
        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "nix-systems",
 | 
			
		||||
        "repo": "default",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "root": "root",
 | 
			
		||||
  "version": 7
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								meta/nix/flake.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								meta/nix/flake.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
{
 | 
			
		||||
  description = "The *magical* build system and package manager";
 | 
			
		||||
 | 
			
		||||
  inputs = {
 | 
			
		||||
    nixpkgs.url = "nixpkgs/nixos-23.11";
 | 
			
		||||
    flake-utils.url = "github:numtide/flake-utils";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  outputs = { self, nixpkgs, flake-utils }:
 | 
			
		||||
    flake-utils.lib.eachDefaultSystem (system:
 | 
			
		||||
      let
 | 
			
		||||
        pkgs = nixpkgs.legacyPackages.${system};
 | 
			
		||||
        ck = pkgs.python311Packages.buildPythonApplication {
 | 
			
		||||
          pyproject = true;
 | 
			
		||||
          pname = "cutekit";
 | 
			
		||||
          version = "0.7-dev";
 | 
			
		||||
 | 
			
		||||
          src = ./../..;
 | 
			
		||||
 | 
			
		||||
          nativeBuildInputs = with pkgs.python311Packages; [ setuptools ];
 | 
			
		||||
          propagatedBuildInputs = with pkgs.python311Packages; [
 | 
			
		||||
            dataclasses-json
 | 
			
		||||
            docker
 | 
			
		||||
            requests
 | 
			
		||||
            graphviz
 | 
			
		||||
          ];
 | 
			
		||||
        };
 | 
			
		||||
      in {
 | 
			
		||||
        package.ck = ck;
 | 
			
		||||
        defaultPackage = self.package.${system}.ck;
 | 
			
		||||
      });
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue